RuntimeCompletionVariable.fromJson constructor

RuntimeCompletionVariable.fromJson(
  1. JsonDecoder jsonDecoder,
  2. String jsonPath,
  3. Object? json
)

Implementation

factory RuntimeCompletionVariable.fromJson(
    JsonDecoder jsonDecoder, String jsonPath, Object? json) {
  json ??= {};
  if (json is Map) {
    String name;
    if (json.containsKey('name')) {
      name = jsonDecoder.decodeString('$jsonPath.name', json['name']);
    } else {
      throw jsonDecoder.mismatch(jsonPath, 'name');
    }
    RuntimeCompletionExpressionType type;
    if (json.containsKey('type')) {
      type = RuntimeCompletionExpressionType.fromJson(
          jsonDecoder, '$jsonPath.type', json['type']);
    } else {
      throw jsonDecoder.mismatch(jsonPath, 'type');
    }
    return RuntimeCompletionVariable(name, type);
  } else {
    throw jsonDecoder.mismatch(jsonPath, 'RuntimeCompletionVariable', json);
  }
}