You need to create other event
, and dispatch
this event
in your callback
function, then you can do what you want in the function that filter your events
.
I don’t know what is the purpose of your BLoC, but the name of this event
depends on the use case, it can be UpdateForm
, UpdateState
, LoggedIn
,LoggedOut
, etc. You will find the most descriptive name for your use case.
Remember that you can also create this event
with parameters, for example UpdateForm (bool isLoggedIn)
, and yield
different states
according to your conditions.
For the example, the name of this event
is OtherEvent
.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | if (event is Login) { yield currentState.copyWith(formProcessing: true); store.dispatch(authActions.login( currentState.username, currentState.password, (error, data) { print(error); print(data); dispatch(OtherEvent()); }, )); } else if (event is OtherEvent) { // You can yield here what you want yield currentState.copyWith(formProcessing: false); } |
If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.