asLists<T> method
Implementation
List? asLists<T>(List<String> keys, [Function(Map<String, dynamic> json)? toBean]) {
for (final String key in keys) {
try {
if (this[key] != null) {
if (toBean != null && this[key] != null) {
return (this[key] as List).map((v) => toBean(v)).toList().cast<T>();
} else {
if (T.toString() == 'double') {
return (this[key] as List).map((v) => double.tryParse(v.toString())).toList().cast<T>();
}
return List<T>.from(this[key]);
}
}
} catch (e) {
_print('json 解析异常,异常值:"$key":${this[key]}');
}
}
return null;
}