decodeAny static method
Implementation
static Map<String, Object?> decodeAny(Object? body) {
Object? decoded;
switch (body) {
case List<int>():
if (body.isEmpty) return const {};
decoded = decode(body);
case String():
if (body.isEmpty) return const {};
decoded = jsonDecode(body);
default:
_invalidJson(body);
}
return switch (decoded) {
null => const <String, Object?>{},
Map<String, Object?>() => decoded,
_ => _invalidJson(decoded),
};
}