body<T extends JsonModel> method

T body<T extends JsonModel>()

Converts the response data to a JsonModel object.

Type Parameter:

  • T: The type of JsonModel to convert the data into.

Returns:

  • The JsonModel instance populated with the response data.

Implementation

T body<T extends JsonModel>() {
  final T model = GetIt.instance.get<T>();
  model.fromJSON(data);
  return model;
}