getList method

Future<List<T>> getList(
  1. String url
)

Fetches a list of objects from the API and parses them into models.

Returns an empty list if parsing fails.

Implementation

Future<List<T>> getList(String url) async {
  final jsonList = await apiClient.getList(url);

  return SafeParser.parseList<T>(
    modelName: modelName,
    jsonList: jsonList,
    fromJson: fromJson,
  );
}