Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GetxController value change listen is called without widget init #3009

Open
magic3584 opened this issue Jan 8, 2024 · 0 comments
Open

GetxController value change listen is called without widget init #3009

magic3584 opened this issue Jan 8, 2024 · 0 comments
Assignees

Comments

@magic3584
Copy link

Describe the bug
I have a manager which extends the GetxController. The manager has a timer and start counting down when push to a new page.
I have 3 pages that are A->B->C, the manager restart timer when push to B and C, and C.page looks like

@override
  void initState() {
    // TODO: implement initState
    super.initState();
    WidgetsBinding.instance.addPostFrameCallback((_) {
      countManager.startCountDown(10);
      countManager.count.listen((value) {
        if (countManager.isCounting &&
            value == 0 &&
            Get.currentRoute == '/CourierQrcodePage') {
          debugPrint("value---------:$value");
          debugPrint('_pushToHomePage');
          countManager.stopCountDown();
          Get.until((route) => route.isFirst);
        }
      }); 
    });
  }

It works fine the first time and C has been disposed. But when I push like A->B, the debugPrint has show without C init. Why? And another question is that when I push to C, it back to A immediately.
Flutter Version:
3.13.9

Getx Version:
4.6.6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants