ChangeContentOverlay.fromJson constructor
ChangeContentOverlay.fromJson(
- JsonDecoder jsonDecoder,
- String jsonPath,
- Object? json
)
Implementation
factory ChangeContentOverlay.fromJson(
JsonDecoder jsonDecoder, String jsonPath, Object? json) {
json ??= {};
if (json is Map) {
if (json['type'] != 'change') {
throw jsonDecoder.mismatch(jsonPath, 'equal change', json);
}
List<SourceEdit> edits;
if (json.containsKey('edits')) {
edits = jsonDecoder.decodeList(
'$jsonPath.edits',
json['edits'],
(String jsonPath, Object? json) =>
SourceEdit.fromJson(jsonDecoder, jsonPath, json));
} else {
throw jsonDecoder.mismatch(jsonPath, 'edits');
}
return ChangeContentOverlay(edits);
} else {
throw jsonDecoder.mismatch(jsonPath, 'ChangeContentOverlay', json);
}
}