getList<T> method

Future<List<T>> getList<T>(
  1. String key,
  2. T fromMap(
    1. Map<String, dynamic> v
    )
)

Implementation

Future<List<T>> getList<T>(String key, T fromMap(Map<String, dynamic> v)) async{
  String jsonResult = _get(key, "");
  if(ObjectUtil.isNotEmpty(jsonResult)){
    List list = await Isolate.compute(_decode, jsonResult);
    return list.map((e){
      if(e is String){
        return fromMap(json.decode(e));
      }
      return fromMap(e);
    }).toList();
  }
  return [];
}