copyWith method
Creates a new instance with updated fields, preserving the values of any fields not explicitly specified.
Implementation
DependencyMetadata copyWith({
Entity groupEntity = const DefaultEntity(),
Entity preemptivetypeEntity = const DefaultEntity(),
Option<Type> initialType = const None(),
Option<int> index = const None(),
Option<TOnUnregisterCallback<Object>> onUnregister = const None(),
}) {
return DependencyMetadata(
groupEntity: groupEntity.isNotDefault() ? groupEntity : this.groupEntity,
preemptivetypeEntity: preemptivetypeEntity.isNotDefault()
? preemptivetypeEntity
: this.preemptivetypeEntity,
index: switch (index) {
Some() => index,
None() => this.index,
},
onUnregister: switch (onUnregister) {
Some() => onUnregister,
None() => this.onUnregister,
},
).._initialType = switch (initialType) {
Some() => initialType,
None() => _initialType,
};
}