clone method

RunOptions clone ({String workingDirectory, Map<String, String> environment, bool includeParentEnvironment, bool runInShell, Encoding stdoutEncoding, Encoding stderrEncoding })

Create a clone with updated values in one step. For omitted parameters values of the original instance are copied.

Implementation

RunOptions clone(
    {String workingDirectory,
    Map<String, String> environment,
    bool includeParentEnvironment,
    bool runInShell,
    Encoding stdoutEncoding,
    Encoding stderrEncoding}) {
  Map<String, String> env;
  if (environment != null) {
    env = new Map.from(environment);
  } else {
    env = this.environment != null ? new Map.from(this.environment) : {};
  }
  return new RunOptions(
      workingDirectory:
          workingDirectory != null ? workingDirectory : this.workingDirectory,
      environment: env,
      includeParentEnvironment: includeParentEnvironment != null
          ? includeParentEnvironment
          : this.includeParentEnvironment,
      runInShell: runInShell != null ? runInShell : this.runInShell,
      stdoutEncoding:
          stdoutEncoding != null ? stdoutEncoding : this.stdoutEncoding,
      stderrEncoding:
          stderrEncoding != null ? stderrEncoding : this.stderrEncoding);
}