convertFromJson<ResultType, Item> method
convert a json string to a builtvalue with type ResultType
Implementation
ResultType? convertFromJson<ResultType, Item>(dynamic data, [String? key]) {
try {
if (data is String) data = json.decode(data);
if (data is String) data = json.decode(data);
} catch (e) {
if (kDebugMode) {
print(
'in convert fromjson error $e, $key, ${data?.runtimeType}, $data');
}
}
try {
return _decode<Item>(_getBody(data, key));
} catch (e, _) {
if (kDebugMode) {
print(e);
print(_);
}
return null;
}
}