body<T extends JsonModel> method

T body<T extends JsonModel>()

Converts the response data to a JsonModel instance.

Type Parameter:

Returns:

  • A T instance populated with the response data.

Implementation

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