Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update field_bloc.dart #337

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

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.

None yet

2 participants