TestNativePlatform constructor
- @visibleForTesting
- Map<
String, String> ? environment, - String? executable,
- List<
String> ? executableArguments, - String? lineTerminator,
- String? localeName,
- String? localHostname,
- int? numberOfProcessors,
- String? operatingSystem,
- String? operatingSystemVersion,
- String? packageConfig,
- String? pathSeparator,
- String? resolvedExecutable,
- Uri? script,
- bool? stdinSupportsAnsi,
- bool? stdoutSupportsAnsi,
- 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;