Trying to update BottomNavigationBarItems based on user successful signUp/signIn.
Not an expert in flutter or AWS, but have tried using either of the following to update a bool flag to render _listA
or _listB
Amplify.Auth.fetchAuthSession()
Amplify.Auth.getCurrentUser()
The problem I'm having is the BottomNavigationBar
renders faster than the above functions and app needs to reload to show the correct bar items.
Is there a solution like the following?
bottomNavigationBar: StreamBuilder<SomeState>(
stream: Amplify.Auth.SomeState,
builder: (context, snapshot) {
return BottomNavigationBar(
...
Any other alternative would be appreciated as well.
You can't directly use a
StreamBuilder
for this job, but you can useStreamsubScription
for auth events:You can read the documentation for more information: https://docs.amplify.aws/lib/auth/auth-events/q/platform/flutter/