I pass data in getx routes but I don't understand how to get data on the next page.
List<UserModel> list = [];
var itemid = snapshot.data?.docs[index].id;
Get.toNamed(RoutesName.editAddNewHome_Screen,
arguments: [List[index],itemid ]);
I tried to get data on the next page but it showed an error.
List<dynamic> args = Get.arguments;
List<String> listData = args[0];
var myVariable = args[1];
error - The instance member 'args' can't be accessed in an initializer.
With Getx Routing data are passed as map to an arguments
In your case for retrieving the passed data using Get.arguments["itemId"], You can retrieve this data directly on your Widget, or get the value on initState this will solve error - The instance member 'args' can't be accessed in an initializer.
But I would suggest making this data required on the screen and then passing this data on your route file
In your route file:
For in-depth understanding, check: https://github.com/jonataslaw/getx/blob/master/documentation/en_US/route_management.md