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