SuitePlatform constructor

SuitePlatform(
  1. Runtime runtime, {
  2. Compiler? compiler,
  3. OperatingSystem os = OperatingSystem.none,
  4. bool inGoogle = false,
})

Creates a new platform with the given runtime and os, which defaults to OperatingSystem.none.

Throws an ArgumentError if runtime is a browser and os is not null or OperatingSystem.none.

If compiler is null, then the default compiler for runtime will be used.

Implementation

SuitePlatform(
  this.runtime, {
  // TODO(https://github.com/dart-lang/test/issues/1935): make required
  Compiler? compiler,
  this.os = OperatingSystem.none,
  this.inGoogle = false,
}) : compiler = compiler ?? runtime.defaultCompiler {
  if (runtime.isBrowser && os != OperatingSystem.none) {
    throw ArgumentError('No OS should be passed for runtime "$runtime".');
  }
  if (!runtime.supportedCompilers.contains(this.compiler)) {
    throw ArgumentError(
      'The platform $runtime does not support the compiler ${this.compiler}',
    );
  }
}