RuntimeCompletionExpressionType.fromJson constructor
RuntimeCompletionExpressionType.fromJson(
- JsonDecoder jsonDecoder,
- String jsonPath,
- Object? json
)
Implementation
factory RuntimeCompletionExpressionType.fromJson(
JsonDecoder jsonDecoder, String jsonPath, Object? json) {
json ??= {};
if (json is Map) {
String? libraryPath;
if (json.containsKey('libraryPath')) {
libraryPath = jsonDecoder.decodeString(
'$jsonPath.libraryPath', json['libraryPath']);
}
RuntimeCompletionExpressionTypeKind kind;
if (json.containsKey('kind')) {
kind = RuntimeCompletionExpressionTypeKind.fromJson(
jsonDecoder, '$jsonPath.kind', json['kind']);
} else {
throw jsonDecoder.mismatch(jsonPath, 'kind');
}
String? name;
if (json.containsKey('name')) {
name = jsonDecoder.decodeString('$jsonPath.name', json['name']);
}
List<RuntimeCompletionExpressionType>? typeArguments;
if (json.containsKey('typeArguments')) {
typeArguments = jsonDecoder.decodeList(
'$jsonPath.typeArguments',
json['typeArguments'],
(String jsonPath, Object? json) =>
RuntimeCompletionExpressionType.fromJson(
jsonDecoder, jsonPath, json));
}
RuntimeCompletionExpressionType? returnType;
if (json.containsKey('returnType')) {
returnType = RuntimeCompletionExpressionType.fromJson(
jsonDecoder, '$jsonPath.returnType', json['returnType']);
}
List<RuntimeCompletionExpressionType>? parameterTypes;
if (json.containsKey('parameterTypes')) {
parameterTypes = jsonDecoder.decodeList(
'$jsonPath.parameterTypes',
json['parameterTypes'],
(String jsonPath, Object? json) =>
RuntimeCompletionExpressionType.fromJson(
jsonDecoder, jsonPath, json));
}
List<String>? parameterNames;
if (json.containsKey('parameterNames')) {
parameterNames = jsonDecoder.decodeList('$jsonPath.parameterNames',
json['parameterNames'], jsonDecoder.decodeString);
}
return RuntimeCompletionExpressionType(kind,
libraryPath: libraryPath,
name: name,
typeArguments: typeArguments,
returnType: returnType,
parameterTypes: parameterTypes,
parameterNames: parameterNames);
} else {
throw jsonDecoder.mismatch(
jsonPath, 'RuntimeCompletionExpressionType', json);
}
}