updateWith method
void
updateWith(
- T mutater(
- T
Updates the current ValueWrapperProperty.value
with the result of calling mutater on it.
This can make it easier to update states using their copyWith methods:
final myDataManager = capsule((use) => use.data(MyData()));
// ...
use(myDataManager).updateWith((data) => data.copyWith(foo: bar));
NOTE: this is experimental because I think a future macro that generates a
dedicated updateWith for each type of ValueWrapper<T> could be nice.
Implementation
void updateWith(T Function(T) mutater) => value = mutater(value);