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,
}) {
if (!decoders.containsKey(type)) {
throw StateError(
'Your bootstrap/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;
}