setState method

  1. @override
void setState(
  1. S update, {
  2. String? event,
  3. bool shouldPersist = true,
})

Called by blocs (subclasses) when the state is updated

isBusy and error are cleared whenever the state is updated Optional argument event is the name of event which is calling setState

Implementation

@override
void setState(S update, {String? event, bool shouldPersist = true}) {
  super.setState(update, event: event);

  if (shouldPersist) {
    final write = _isPrimitive(state) ? state : _serialize(state);
    _persistenceService.set(persistenceKey, write);
  }
}