Bloc: Second yield not received by bloc builder

Created on 13 Sep 2020  路  4Comments  路  Source: felangel/bloc

Hi,

I tried to make your login example work in my current project.
Almost everything works fine !
I have a problem when firing the LoginSubmitted event.

My blocBuilder is notified when the first yield is fired:

yield state.copyWith(status: FormzStatus.submissionInProgress);

But never notified when the second yield is fired:

yield state.copyWith(status: FormzStatus.submissionSuccess);

In debug mode, my breakpoint is reached so the submissionSuccess is normally fired.

I'm not able to provide a sample to test, since the code is client payed.

Any idea why only 1 yield is received when firing the LoginSubmitted event?

context.bloc().add(const LoginSubmitted());

Thanks for any advice ;)

question

Most helpful comment

Thank you so much @RollyPeres 馃檹

This issue can be closed !

All 4 comments

Hi @LaurentMalmendier 馃憢
Thanks for opening an issue!

Can you please provide a link to a complete sample app which illustrates the issue? I鈥檓 guessing you鈥檙e navigating to another screen on submissionSuccess which could result in the widget being unmounted. Thanks! 馃檹

Hi @felangel

Thank you for your quick reply, really appreciate ;)

Here is a sample App.

The BlocBuilder in sign_in_screen receive the initial state (none).
When we click the login button, the bloc builder receive the first yield "submissionInProgress". But not the second yield fired 3 secondes later (submissionSuccess).

It is very likely that i didn't understand the core concept of bloc ^_^

Hi @LaurentMalmendier 馃憢

I fixed your issue in this PR.
You didn't pass your status to equatable's props thus your states were considered equal.

Thank you so much @RollyPeres 馃檹

This issue can be closed !

Was this page helpful?
0 / 5 - 0 ratings

Related issues

abinvp picture abinvp  路  3Comments

clicksocial picture clicksocial  路  3Comments

craiglabenz picture craiglabenz  路  3Comments

frankrod picture frankrod  路  3Comments

1AlexFix1 picture 1AlexFix1  路  3Comments