copyWith method

Inheritable<T> copyWith({
  1. Key? key,
  2. T? value,
  3. Set<AspectOverride<Object, T>>? overrides,
  4. Widget? child,
})

Create a new Inheritable of T with it's properties changed with the supplied values

Returns this if all parameters are null.

Implementation

Inheritable<T> copyWith({
  Key? key,
  T? value,
  Set<AspectOverride<Object, T>>? overrides,
  Widget? child,
}) {
  if ([key, value, overrides, child].whereType<Object>().isEmpty) return this;

  return Inheritable<T>._(
    key: key ?? this.key,
    value: value ?? _value,
    overrides: overrides != null ? newOverridesSet(overrides) : _overrides,
    child: child ?? this.child,
  );
}