asBean<T> method
解析成 model
Implementation
T? asBean<T>(String key, Function(Map json) toBean) {
if (this == null) return null;
try {
Object? obj = this![key];
if (obj != null && _isClassBean(obj)) {
return toBean(this![key]);
} else if (obj != null && obj is String) {
Map _map = jsonDecode(obj);
return toBean(_map);
}
} catch (e) {
print(e);
_print('json parse failed,exception value::\"$key\":${this![key]}');
_printDetail('asBean', key, this);
}
return null;
}