LinkedEditGroup.fromJson constructor
LinkedEditGroup.fromJson(
- JsonDecoder jsonDecoder,
- String jsonPath,
- Object? json
)
Implementation
factory LinkedEditGroup.fromJson(
JsonDecoder jsonDecoder, String jsonPath, Object? json) {
json ??= {};
if (json is Map) {
List<Position> positions;
if (json.containsKey('positions')) {
positions = jsonDecoder.decodeList(
'$jsonPath.positions',
json['positions'],
(String jsonPath, Object? json) =>
Position.fromJson(jsonDecoder, jsonPath, json));
} else {
throw jsonDecoder.mismatch(jsonPath, 'positions');
}
int length;
if (json.containsKey('length')) {
length = jsonDecoder.decodeInt('$jsonPath.length', json['length']);
} else {
throw jsonDecoder.mismatch(jsonPath, 'length');
}
List<LinkedEditSuggestion> suggestions;
if (json.containsKey('suggestions')) {
suggestions = jsonDecoder.decodeList(
'$jsonPath.suggestions',
json['suggestions'],
(String jsonPath, Object? json) =>
LinkedEditSuggestion.fromJson(jsonDecoder, jsonPath, json));
} else {
throw jsonDecoder.mismatch(jsonPath, 'suggestions');
}
return LinkedEditGroup(positions, length, suggestions);
} else {
throw jsonDecoder.mismatch(jsonPath, 'LinkedEditGroup', json);
}
}