DiagnosticMessage.fromJson constructor
DiagnosticMessage.fromJson(})
Implementation
factory DiagnosticMessage.fromJson(
JsonDecoder jsonDecoder,
String jsonPath,
Object? json, {
ClientUriConverter? clientUriConverter,
}) {
json ??= {};
if (json is Map) {
String message;
if (json.containsKey('message')) {
message = jsonDecoder.decodeString(
'$jsonPath.message',
json['message'],
);
} else {
throw jsonDecoder.mismatch(jsonPath, 'message');
}
Location location;
if (json.containsKey('location')) {
location = Location.fromJson(
jsonDecoder,
'$jsonPath.location',
json['location'],
clientUriConverter: clientUriConverter,
);
} else {
throw jsonDecoder.mismatch(jsonPath, 'location');
}
return DiagnosticMessage(message, location);
} else {
throw jsonDecoder.mismatch(jsonPath, 'DiagnosticMessage', json);
}
}