DefaultResponse<T>.fromJson constructor

DefaultResponse<T>.fromJson(
  1. dynamic json,
  2. Map<Type, dynamic> decoders, {
  3. required Type type,
})

Implementation

DefaultResponse.fromJson(json, Map<Type, dynamic> decoders,
    {required Type type}) {
  assert(decoders.containsKey(type),
      'Your config/decoders.dart file does not contain a decoder for the following class: ${type.toString()} in modelDecoders');
  dynamic jsonResponse = decoders[type]!(json);
  if (jsonResponse == null) {
    data = null;
    return;
  }
  data = jsonResponse as T;
}