kfromJsonMapT<K, T> method
json转Map<K, T?>,T = bean对象
Map<String,User?>? map = mapTStr.kfromJsonMapT((json) => User.fromJson(json));
Implementation
Map<K, T?>? kfromJsonMapT<K, T>(T Function(dynamic json) fromJsonT) {
var file = this;
if (file == null || file.isEmpty) {
return null;
}
Map map = jsonDecode(file);
var newMap = <K, T?>{};
map.forEach((key, value) {
newMap[key] = value == null ? null : fromJsonT(jsonDecode(value));
});
return newMap;
}