decodeArgs static method
Decodes the JSON-encoded args parameter of a service extension call.
Implementation
static Map<String, dynamic> decodeArgs(String? raw) {
if (raw == null || raw.trim().isEmpty) return {};
final dynamic decoded;
try {
decoded = jsonDecode(raw);
} on FormatException {
throw const LiveException.invalidParams('"args" must be a JSON object.');
}
if (decoded is! Map) {
throw const LiveException.invalidParams('"args" must be a JSON object.');
}
return Map<String, dynamic>.from(decoded);
}