getObjects<T extends VasatModel<T>> method
Implementation
@override
Future<List<T>> getObjects<T extends VasatModel<T>>(VasatFromJsonFactory<T> factory) {
// use factory to construct empty object just to get the vasat object name.
var vasatObjectName = factory({}).getObjectName();
return SharedPreferences.getInstance().then((prefs) {
var stringObjs = prefs.getString( vasatObjectName );
Map<String, dynamic> mapObjs = {};
if (stringObjs != null) mapObjs = jsonDecode(stringObjs);
List<T> objList = mapObjs.entries.map((ele) => factory(ele.value) ).toList();
return objList;
});
}