call method
Replaces state with value.
A function can also be passed directly, matching React's functional
updater form: setCount((previous) => previous + 1).
Implementation
void call(Object? value) {
if (value is Function) {
final dynamic updater = value;
_setUpdater((previous) => updater(previous) as T);
return;
}
if (value is T || value == null) {
_setValue(value as T);
return;
}
throw ArgumentError.value(value, 'value', 'Expected T or T Function(T).');
}