list method
Get all the models of type T.
- Returns: A Future containing a list of models of type T.
Implementation
Future<List<T>> list() async {
final models = <T>[];
final jsonData = await _fetchData();
for (final key in jsonData.keys) {
if (jsonData[key] is Map<String, dynamic>) {
final modelJsonData = jsonData[key];
if (modelJsonData is Map<String, dynamic>) {
final model = _parseModel(key, modelJsonData);
if (model != null) {
models.add(model);
}
}
}
}
return models;
}