TestNativePlatform constructor

  1. @visibleForTesting
TestNativePlatform({
  1. Map<String, String>? environment,
  2. String? executable,
  3. List<String>? executableArguments,
  4. String? lineTerminator,
  5. String? localeName,
  6. String? localHostname,
  7. int? numberOfProcessors,
  8. String? operatingSystem,
  9. String? operatingSystemVersion,
  10. String? packageConfig,
  11. String? pathSeparator,
  12. String? resolvedExecutable,
  13. Uri? script,
  14. bool? stdinSupportsAnsi,
  15. bool? stdoutSupportsAnsi,
  16. String? version,
})

Creates a new TestNativePlatform with the specified properties.

Parameters that are not provided with a non-null value will leave the corresponding property without a value.

Reading, for example, TestNativePlatform.operatingSystem when it had not been given a value, will throw an error. This behavior can be used in tests to ensure that code does not read properties that it is not supposed to.

The operatingSystem string must be one of the known operating system ID strings in NativePlatform.operatingSystemValues.

Implementation

@visibleForTesting
TestNativePlatform({
  Map<String, String>? environment,
  String? executable,
  List<String>? executableArguments,
  String? lineTerminator,
  String? localeName,
  String? localHostname,
  int? numberOfProcessors,
  String? operatingSystem,
  String? operatingSystemVersion,
  this.packageConfig,
  String? pathSeparator,
  String? resolvedExecutable,
  Uri? script,
  bool? stdinSupportsAnsi,
  bool? stdoutSupportsAnsi,
  String? version,
}) : _environment = environment == null
         ? null
         : operatingSystem == NativePlatform.windows
         ? (_caseInsensitiveMap()..addAll(environment))
         : environment,
     _executable = executable,
     _executableArguments = executableArguments,
     _lineTerminator = lineTerminator,
     _localeName = localeName,
     _localHostname = localHostname,
     _numberOfProcessors = numberOfProcessors,
     _operatingSystem = operatingSystem,
     _operatingSystemVersion = operatingSystemVersion,
     _pathSeparator = pathSeparator,
     _resolvedExecutable = resolvedExecutable,
     _script = script,
     _stdinSupportsAnsi = stdinSupportsAnsi,
     _stdoutSupportsAnsi = stdoutSupportsAnsi,
     _version = version;