getObject<T> static method
Converts JSON string or JSON map source
to object.
Implementation
static T? getObject<T>(dynamic source, T Function(Map v) f) {
if (source == null || source.toString().isEmpty) return null;
try {
Map map;
if (source is String) {
map = json.decode(source);
} else {
map = source;
}
return f(map);
} catch (e) {
debugPrint('JsonUtil convert error, Exception:${e.toString()}');
}
return null;
}