Skip to content

StateNotifier as Listenable #1013

Answered by iamarnas
GitGud31 asked this question in Q&A
Dec 16, 2021 · 2 comments · 7 replies
Discussion options

You must be logged in to vote

You handle the simple boolean state. Your StateNotifier should look like this:

class AuthStateNotifier extends StateNotifier<bool>{
  AuthStateNotifier() : super(false);

  void authenticate() {
    state = true;
  }

  void logout() {
    state = false;
  } 

Replies: 2 comments 7 replies

Comment options

You must be logged in to vote
7 replies
@iamarnas
Comment options

@GitGud31
Comment options

@GitGud31
Comment options

@iamarnas
Comment options

@GitGud31
Comment options

Answer selected by GitGud31
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants