Bloc: Unable to re-login after logout in flutter_login

Created on 26 Jul 2019  路  3Comments  路  Source: felangel/bloc

Sorry to bother you again. I cannot re-login after logout. I checked this similar issue https://github.com/felangel/bloc/issues/322#issue-449725258, but still don't know how to solve it.
Here is the code: https://github.com/2000calories/flutter_login_test.git

question

Most helpful comment

In your setting,dart file, if not necessary to create new stack (LoginPage), I think you just need to change

Navigator.push(
context,
MaterialPageRoute(builder: (_) => LoginPage(userRepository: userRepository)),
);

To

Navigator.pushNamedAndRemoveUntil(context, '/', (_) => false);

All 3 comments

In your setting,dart file, if not necessary to create new stack (LoginPage), I think you just need to change

Navigator.push(
context,
MaterialPageRoute(builder: (_) => LoginPage(userRepository: userRepository)),
);

To

Navigator.pushNamedAndRemoveUntil(context, '/', (_) => false);

Hi @2000calories 馃憢
Thanks for opening an issue!

As @cemanganas pointed out you are pushing a new LoginPage to the navigations stack instead of popping the current one off of the stack so you're basically building up a stack multiple widgets deep which covers up the root widget.

Hope that helps!

in similar case i use phoenix package and wrap app with it and its fix my issue.
link is : https://pub.dev/packages/flutter_phoenix

Was this page helpful?
0 / 5 - 0 ratings