# Calling notifyListeners(); two successive times!

**URL:** <https://forums.kodeco.com/t/calling-notifylisteners-two-successive-times/156227>\
**Category:** Flutter Apprentice\
**Created:** [November 7, 2021, 2:06pm UTC](https://forums.kodeco.com/t/calling-notifylisteners-two-successive-times/156227 "2021-11-07T14:06:19Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![alilosoft](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/alilosoft/32/99601_2.png) [@alilosoft](https://forums.kodeco.com/u/alilosoft)\
**Post date:** [November 7, 2021, 2:06pm UTC](https://forums.kodeco.com/t/calling-notifylisteners-two-successive-times/156227/1 "2021-11-07T14:06:19Z")

</div>

### Chapter 7 ➡ Adding the log out capability

In the snippet bellow, doesn’t `initializeApp();` notify listeners? why we should call `notifyListeners();` again?

```auto
void logout() {

    _loggedIn = false;

    _onboardingComplete = false;

    _initialized = false;

    _selectedTab = FooderlichTab.explore;

    initializeApp();

    notifyListeners();

  }

```

---

<div class="post-metadata">

**Author:** ![olivaxa](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/olivaxa/32/81494_2.png) [@olivaxa](https://forums.kodeco.com/u/olivaxa)\
**Post date:** [November 7, 2021, 3:44pm UTC](https://forums.kodeco.com/t/calling-notifylisteners-two-successive-times/156227/2 "2021-11-07T15:44:49Z")

</div>

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();

```

}

---

<div class="post-metadata">

**Author:** ![olivaxa](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/olivaxa/32/81494_2.png) [@olivaxa](https://forums.kodeco.com/u/olivaxa)\
**Post date:** [November 7, 2021, 4:24pm UTC](https://forums.kodeco.com/t/calling-notifylisteners-two-successive-times/156227/3 "2021-11-07T16:24:59Z")

</div>

Is it possible to use this code ?

```auto
void logout() {

_loggedIn = false;

_onboardingComplete = false;

_initialized = false;

_selectedTab = FooderlichTab.explore;

initializeApp();

}

```

notifyListeners() will be call only one time with initializeApp().
