DefaultResponse<T>.fromJson constructor

DefaultResponse<T>.fromJson(
  1. dynamic json,
  2. Map<Type, dynamic> decoders, {
  3. required Type type,
  4. 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;
}