Skip to content

Conversation

@mrchenmo
Copy link

@mrchenmo mrchenmo commented Nov 2, 2023

When modifying emit, _stateController may have been closed and an error will be thrown. All emit methods should check whether the isClosed value has been reached before calling.

void onEmit(State state) {
          if (isClosed) return;
          if (this.state == state && _emitted) return;
          onTransition(
            Transition(
              currentState: this.state,
              event: event as E,
              nextState: state,
            ),
          );
          emit(state);
        }

All emit methods in the source code will check the value of isClosed before calling it.

When modifying emit, _stateController may have been closed and an error will be thrown. All emit methods should check whether the isClosed value has been reached before calling.
@richard457
Copy link

does this fix this #338 @mrchenmo ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants