CompletionGetSuggestionsResult.fromJson constructor
CompletionGetSuggestionsResult.fromJson(})
Implementation
factory CompletionGetSuggestionsResult.fromJson(
JsonDecoder jsonDecoder,
String jsonPath,
Object? json, {
ClientUriConverter? clientUriConverter,
}) {
json ??= {};
if (json is Map) {
int replacementOffset;
if (json.containsKey('replacementOffset')) {
replacementOffset = jsonDecoder.decodeInt(
'$jsonPath.replacementOffset',
json['replacementOffset'],
);
} else {
throw jsonDecoder.mismatch(jsonPath, 'replacementOffset');
}
int replacementLength;
if (json.containsKey('replacementLength')) {
replacementLength = jsonDecoder.decodeInt(
'$jsonPath.replacementLength',
json['replacementLength'],
);
} else {
throw jsonDecoder.mismatch(jsonPath, 'replacementLength');
}
List<CompletionSuggestion> results;
if (json.containsKey('results')) {
results = jsonDecoder.decodeList(
'$jsonPath.results',
json['results'],
(String jsonPath, Object? json) => CompletionSuggestion.fromJson(
jsonDecoder,
jsonPath,
json,
clientUriConverter: clientUriConverter,
),
);
} else {
throw jsonDecoder.mismatch(jsonPath, 'results');
}
return CompletionGetSuggestionsResult(
replacementOffset,
replacementLength,
results,
);
} else {
throw jsonDecoder.mismatch(
jsonPath,
'completion.getSuggestions result',
json,
);
}
}