Skip to content

Unexpected state value when accessing NotifierStore's state using Modular.get<E>() inside Guard.  #643

@xbrny

Description

@xbrny

Describe the bug
Unexpected state value when accessing NotifierStore's state using Modular.get() inside Guard.

Environment

Flutter 2.8.1 • channel stable • https://github.com/flutter/flutter.git
Framework • revision 77d935af4d (7 weeks ago) • 2021-12-16 08:37:33 -0800
Engine • revision 890a5fca2e
Tools • Dart 2.15.1

To Reproduce

  1. Clone the git repository below & run the project
  2. Press "login" button (AuthStore's state change to true)
  3. Press "logout" button (AuthStore's state change to false)
  4. Press "login" button, state change to true but AuthGuard prevents navigation to "/" because it reads AuthStore's state as false

Expected behavior
Expecting the AuthStore's state in AuthGuard to be true during the second time login

Git repository
https://github.com/xbrny/flutter_modular_guard_issue

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions