I'm making a flutter app using GetX.
I want to know where to write the navigation function of GetX, between widgets and controllers.
ex) GetX.toNamed()
, GetX.back()
If the widget has to handle it, how do you deliver an event from the controller to the widget when the screen needs to be moved after networking in the controller?
its simple.
create another controller
and check your condition then
if true GetX.back()
else return null
Example.
WillPopScope(
onWillPop: () async {
bool res = await controller.checkfun() ?? false;
if (res) {
return true;
}
return false;
},
child: ...
)