bodyAsList<T extends JsonModel> method
Converts the response data to a list of JsonModel objects.
Type Parameter:
T
: The type of JsonModel to convert each item in the list into.
Returns:
- A list of JsonModel instances populated with the response data.
Implementation
List<T> bodyAsList<T extends JsonModel>() {
return (data as List).map((element) {
final T model = GetIt.instance.get<T>();
model.fromJSON(element);
return model;
}).toList();
}