ExecutionLaunchDataParams.fromJson constructor

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

Implementation

factory ExecutionLaunchDataParams.fromJson(
    JsonDecoder jsonDecoder, String jsonPath, Object? json) {
  json ??= {};
  if (json is Map) {
    String file;
    if (json.containsKey('file')) {
      file = jsonDecoder.decodeString('$jsonPath.file', json['file']);
    } else {
      throw jsonDecoder.mismatch(jsonPath, 'file');
    }
    ExecutableKind? kind;
    if (json.containsKey('kind')) {
      kind = ExecutableKind.fromJson(
          jsonDecoder, '$jsonPath.kind', json['kind']);
    }
    List<String>? referencedFiles;
    if (json.containsKey('referencedFiles')) {
      referencedFiles = jsonDecoder.decodeList('$jsonPath.referencedFiles',
          json['referencedFiles'], jsonDecoder.decodeString);
    }
    return ExecutionLaunchDataParams(file,
        kind: kind, referencedFiles: referencedFiles);
  } else {
    throw jsonDecoder.mismatch(jsonPath, 'execution.launchData params', json);
  }
}