copyWith method

Dependency<T> copyWith({
  1. Option<Resolvable<T>> value = const None(),
  2. Option<DependencyMetadata> metadata = const None(),
})

Creates a new instance with updated fields, preserving the values of any fields not explicitly specified.

Implementation

Dependency<T> copyWith({
  Option<Resolvable<T>> value = const None(),
  Option<DependencyMetadata> metadata = const None(),
}) {
  return Dependency<T>(
    switch (value) {
      Some(value: final v) => v,
      None() => _value,
    },
    metadata: metadata,
  );
}