copyWith method

  1. @visibleForTesting
TestNativePlatform copyWith({
  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 from this one.

If a parameter is given non-null argument value, the created object will have that value for the corresponding property, otherwise it will use this object's value for that property.

Implementation

@visibleForTesting
TestNativePlatform copyWith({
  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,
}) {
  return TestNativePlatform(
    environment:
        environment ??
        (_environment == null ? null : <String, String>{..._environment}),
    executable: executable ?? _executable,
    executableArguments: (executableArguments ?? _executableArguments)
        ?.toList(),
    lineTerminator: lineTerminator ?? _lineTerminator,
    localeName: localeName ?? _localeName,
    localHostname: localHostname ?? _localHostname,
    numberOfProcessors: numberOfProcessors ?? _numberOfProcessors,
    operatingSystem: operatingSystem ?? _operatingSystem,
    operatingSystemVersion: operatingSystemVersion ?? _operatingSystemVersion,
    packageConfig: packageConfig ?? this.packageConfig,
    pathSeparator: pathSeparator ?? _pathSeparator,
    resolvedExecutable: resolvedExecutable ?? _resolvedExecutable,
    script: script ?? _script,
    stdinSupportsAnsi: stdinSupportsAnsi ?? _stdinSupportsAnsi,
    stdoutSupportsAnsi: stdoutSupportsAnsi ?? _stdoutSupportsAnsi,
    version: version ?? _version,
  );
}