Replies: 2 comments 13 replies
-
In this case it would be better to pass the parameter through the constructor |
Beta Was this translation helpful? Give feedback.
13 replies
-
Hi @mrnusa , I was suffering from a very similar scenario as yours - having the same page (view + controller) not being refreshed when called with different arguments. After struggling with it for a few days I finally remembered of the property Please notice that you must keep using the class GroupPage extends StatelessWidget {
final String groupGuid = Get.arguments['groupGuid'];
@override
Widget build(BuildContext context) {
return GetBuilder<GroupController>(
init: GroupController(groupGuid),
tag: groupGuid,
builder: (_) {
return Scaffold(
.
.
.
)
}
);
}
} |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi,
i have some item description pages accessible with the menu drawer. These are named routes the item id passed with 'Get.arguments'.
My problem is because it is accessible from the menu the controller not disposed and when i tap with a different item i see the previous one. (also i have to set preventDuplicates: false to open it again)
How can i track the argument changes? The onInit, onReady not called because is an active controller.
Now i hotfix it with the following way:
In the view i use a GetBuilder, so i use didChangeDependencies callback to check Get.arguments changed or not, if yes i pass it to the controller to refresh data.
Any better way for that?
Or i have to forget named routes and i have to use 'Get.to(NextScreen());' and i have to pass the param to the view constructor?
Thank you!
Beta Was this translation helpful? Give feedback.
All reactions