ExecutionGetSuggestionsResult.fromJson constructor
ExecutionGetSuggestionsResult.fromJson(
- JsonDecoder jsonDecoder,
- String jsonPath,
- Object? json
)
Implementation
factory ExecutionGetSuggestionsResult.fromJson(
JsonDecoder jsonDecoder, String jsonPath, Object? json) {
json ??= {};
if (json is Map) {
List<CompletionSuggestion>? suggestions;
if (json.containsKey('suggestions')) {
suggestions = jsonDecoder.decodeList(
'$jsonPath.suggestions',
json['suggestions'],
(String jsonPath, Object? json) =>
CompletionSuggestion.fromJson(jsonDecoder, jsonPath, json));
}
List<RuntimeCompletionExpression>? expressions;
if (json.containsKey('expressions')) {
expressions = jsonDecoder.decodeList(
'$jsonPath.expressions',
json['expressions'],
(String jsonPath, Object? json) =>
RuntimeCompletionExpression.fromJson(
jsonDecoder, jsonPath, json));
}
return ExecutionGetSuggestionsResult(
suggestions: suggestions, expressions: expressions);
} else {
throw jsonDecoder.mismatch(
jsonPath, 'execution.getSuggestions result', json);
}
}