updateState method
void
updateState(
- S newState
Updates the state of the bloc with a new state instance.
This method is a convenient way to trigger a state update in the bloc without manually creating and dispatching an event.
The newState
parameter represents the new state that you want to set for the bloc. It's
typically a modified version of the current state, created using a copy method.
Example usage:
updateState(
state.copyWith(someValue: event.someValue),
);
This method internally dispatches an UpdateEvent with the newState
, causing the bloc
to emit the updated state to its listeners.
Implementation
void updateState(S newState) {
add(UpdateEvent<S>(newState));
}