Chapter 7 Adding the log out capability
In the snippet bellow, doesn’t initializeApp();
notify listeners? why we should call notifyListeners();
again?
void logout() {
_loggedIn = false;
_onboardingComplete = false;
_initialized = false;
_selectedTab = FooderlichTab.explore;
initializeApp();
notifyListeners();
}
1 Like
Hi.
This question interests me too.
I think this notifylistener (logout one) is useful to « reset » the state.
Then, we call initializeApp to go back to the loading (2sec) and login page.
I wonder if writing the functions in this order is not more understandable and if it’s correct too…
void logout() {
_loggedIn = false;
_onboardingComplete = false;
_initialized = false;
_selectedTab = FooderlichTab.explore;
notifyListeners();
initializeApp();
}
Is it possible to use this code ?
void logout() {
_loggedIn = false;
_onboardingComplete = false;
_initialized = false;
_selectedTab = FooderlichTab.explore;
initializeApp();
}
notifyListeners() will be call only one time with initializeApp().