is it a good practice to send data with arguments in flutter using GetX (or any other way)? i mean is it good for performance and ram capcity ? ... like this example:

Get.toNamed(AppPages.servicesDetails, arguments: [service]);

when (service) contain a data for only one product came from API : like (id, name, info, image ...etc).

and in the servicesDetails page:

 final s = Get.arguments[0];
  Widget build(BuildContext context) {
    return  Scaffold(
      body:  Center(child: Text(,),

Solution 1: Arbiter Chil

You can also used parameters.

 var  data = {
      "email" : "[email protected]",
      "message" : "hi!"
  Get.toNamed(, parameters: data);

Also from getting it from another pages is like this.


Also on Getx you can pass it like a url link on data as the document written.

If you want to pass whole item data, You can also pass a model from list if have onTap function though you need to decode it again


 name: list[index].name,
 ontapFunction: () => Get.toNamed(,
   parameters: {
       /// Lets assume this is the item selected also it's own item data
       "itembyIndex": jsonEncode(list[index]),

from controller

class MyXampleController extends GetxController{

//declare the model
final Rx<Model> model = Model().obs;

  void onInit() {
    final decode = jsonDecode(Get.parameters['itembyIndex']) 
    final passToModel = Model.fromJson(decode);
    // or if you are using getBuilder
    // try do it like this
    // model.value = passToModel;
     // update();
    // don't forget to call update() since it's needed from getbuilder;


Now, For calling the data from ui will be like this

final controller = Get.put(MyXampleController());
///// this will be the data we got from the item

Solution 2: aman

You can simply use arguments

      arguments: "Hello",

on the second screen, you can do

final title = Get.arguments as String;