decodeJsonTree method

  1. @override
int decodeJsonTree(
  1. Object? json
)
override

Converts json (any JSON tree) to an instance of T.

Throws ArgumentError if the JSON does not match.

Implementation

@override
int decodeJsonTree(Object? json) {
  if (json is num) {
    return json.toInt();
  }
  if (json is String) {
    return decodeString(json);
  }
  throw JsonDecodingError.expectedNumberOrString(json);
}