decodeJsonTree method
Converts json
(any JSON tree) to an instance of T
.
Throws ArgumentError if the JSON does not match.
Implementation
@override
DateTime decodeJsonTree(Object? json) {
if (json is String) {
return decodeString(json);
}
if (json is num) {
final intValue = json.toInt();
return _convertDecoded(
DateTime.fromMillisecondsSinceEpoch(intValue, isUtc: true),
);
}
throw JsonDecodingError.expectedString(json);
}