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. bool? caseSensitive,
  10. Object? handlerCacheCapacity = _unset,
  11. ReloadStrategy? reload,
  12. Object? wranglerConfig = _unset,
  13. Object? openapi = _unset,
  14. Object? client = _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,
  bool? caseSensitive,
  Object? handlerCacheCapacity = _unset,
  ReloadStrategy? reload,
  Object? wranglerConfig = _unset,
  Object? openapi = _unset,
  Object? client = _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,
    caseSensitive: caseSensitive ?? this.caseSensitive,
    handlerCacheCapacity: switch (handlerCacheCapacity) {
      _Unset() => this.handlerCacheCapacity,
      null => null,
      int() when handlerCacheCapacity > 0 => handlerCacheCapacity,
      _ => throw ArgumentError.value(
        handlerCacheCapacity,
        'handlerCacheCapacity',
        'must be a positive integer or null',
      ),
    },
    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',
      ),
    },
    openapi: _copyWithOpenApi(openapi, current: this.openapi),
    client: _copyWithClient(client, current: this.client),
  );
}