overrideWith method
- @Deprecated('Use direct signal mutation in tests, or wrap signals in Ref from lite_ref and use Ref.overrideWith instead. ' 'This method will be removed in a future major release.')
- T val
inherited
Override the current signal with a new value as if it was created with it.
This does not trigger any updates.
var counter = signal(0);
// Override the signal with a new value
counter = counter.overrideWith(1);
Implementation
@Deprecated(
'Use direct signal mutation in tests, or wrap signals in Ref from lite_ref and use Ref.overrideWith instead. '
'This method will be removed in a future major release.',
)
Signal<T> overrideWith(T val) {
version = 0;
afterCreate(val);
internalValue = val;
return this;
}