how to use Obx() out side the widget tree? #1304
praburocking
started this conversation in
General
Replies: 2 comments 4 replies
-
You do not need Obx for this use case, as you only need the current value when deciding where to navigate. You can only do this: authController.isLogedIn.value ? Get.toNamed('/home') : Get.toNamed('/login')); |
Beta Was this translation helpful? Give feedback.
1 reply
-
And where is the part of the code that uses |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
i am working on a flutter web project where, i have a variable in controller islogedIn, if it is true i need to display another page, if false i need to display another page. I am trying to implement something like this
Obx(() => authController.isLogedIn.value ? Get.toNamed('/home') : Get.toNamed('/login'));
but it is not working since it has to return a widget, so I also tried something like this
still, this code is not executed, Obx is getting executed only when it is a part of the widget tree. do we have any option to Observe a controller outside a widget tree ?
Beta Was this translation helpful? Give feedback.
All reactions