DefaultResponse<T>.fromJson constructor
DefaultResponse<T>.fromJson(
- dynamic json,
- Map<Type, dynamic> decoders, {
- 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;
}