update method
Update a state via callback receiving the current state. If no callback is given, just notifies BeamerDelegate to rebuild.
Useful with BeamState.copyWith.
Implementation
void update([T Function(T)? copy, bool rebuild = true]) {
if (copy != null) {
state = copy(_state);
}
if (rebuild) {
notifyListeners();
}
}