SourceFileEdit.fromJson constructor
SourceFileEdit.fromJson(})
Implementation
factory SourceFileEdit.fromJson(
JsonDecoder jsonDecoder,
String jsonPath,
Object? json, {
ClientUriConverter? clientUriConverter,
}) {
json ??= {};
if (json is Map) {
String file;
if (json.containsKey('file')) {
file =
clientUriConverter?.fromClientFilePath(
jsonDecoder.decodeString('$jsonPath.file', json['file']),
) ??
jsonDecoder.decodeString('$jsonPath.file', json['file']);
} else {
throw jsonDecoder.mismatch(jsonPath, 'file');
}
int fileStamp;
if (json.containsKey('fileStamp')) {
fileStamp = jsonDecoder.decodeInt(
'$jsonPath.fileStamp',
json['fileStamp'],
);
} else {
throw jsonDecoder.mismatch(jsonPath, 'fileStamp');
}
List<SourceEdit> edits;
if (json.containsKey('edits')) {
edits = jsonDecoder.decodeList(
'$jsonPath.edits',
json['edits'],
(String jsonPath, Object? json) => SourceEdit.fromJson(
jsonDecoder,
jsonPath,
json,
clientUriConverter: clientUriConverter,
),
);
} else {
throw jsonDecoder.mismatch(jsonPath, 'edits');
}
return SourceFileEdit(file, fileStamp, edits: edits);
} else {
throw jsonDecoder.mismatch(jsonPath, 'SourceFileEdit', json);
}
}