copyWith method

BuildConfig copyWith({
  1. String? rootDir,
  2. String? host,
  3. int? port,
  4. BuildTarget? target,
  5. String? routesDir,
  6. String? middlewareDir,
  7. String? publicDir,
  8. String? outputDir,
  9. ReloadStrategy? reload,
  10. Object? wranglerConfig = _unset,
})

Returns a copy with selected fields replaced.

Implementation

BuildConfig copyWith({
  String? rootDir,
  String? host,
  int? port,
  BuildTarget? target,
  String? routesDir,
  String? middlewareDir,
  String? publicDir,
  String? outputDir,
  ReloadStrategy? reload,
  Object? wranglerConfig = _unset,
}) {
  return BuildConfig(
    rootDir: rootDir ?? this.rootDir,
    host: host ?? this.host,
    port: port ?? this.port,
    target: target ?? this.target,
    routesDir: routesDir ?? this.routesDir,
    middlewareDir: middlewareDir ?? this.middlewareDir,
    publicDir: publicDir ?? this.publicDir,
    outputDir: outputDir ?? this.outputDir,
    reload: reload ?? this.reload,
    wranglerConfig: switch (wranglerConfig) {
      _Unset() => this.wranglerConfig,
      String() => wranglerConfig,
      null => null,
      _ => throw ArgumentError.value(
        wranglerConfig,
        'wranglerConfig',
        'must be a string or null',
      ),
    },
  );
}