update method

void update([
  1. T copy(
    1. T
    )?,
  2. bool rebuild = true
])

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();
  }
}