DefaultResponse<T>.fromJson constructor
DefaultResponse<T>.fromJson (
- dynamic json,
- Map<
Type, dynamic> decoders, { - required Type type,
- NyResponse? response,
Decodes json with the decoder for type in decoders.
response is passed to decoders that read it, such as OneOf.
Implementation
DefaultResponse.fromJson(
dynamic json,
Map<Type, dynamic> decoders, {
required Type type,
NyResponse? response,
}) {
dynamic jsonResponse = decodeWithDecoders(
json,
decoders,
type: type,
response: response,
);
if (jsonResponse == null) {
data = null;
return;
}
data = jsonResponse as T;
}