convertResponseToList<T> static method

dynamic convertResponseToList<T>(
  1. Response response,
  2. dynamic func
)

response from the server.

func is passed as the <T>.fromJson for any model

Implementation

static dynamic convertResponseToList<T>(Response response, func) {
  final json = Utils.parseResponseAsJson(response);
  return json.map((e) => func(e)).cast<T>().toList();
}