title: how to to pass id to get data flutter
body: <p>I am using <code>getx</code> rest API by backend URL <code>id</code> wise fetch data how to pass <code>id</code> to url</p>
  <p><code>https://localhost.com/api/users/get_planDetail/{id}</code></p>
  <p>here <code>id</code> pass how
  this is API URL
  <code>https://localhost.com/api/users/get_planDetail/{id}</code></p>
  
  <p><strong>my plan service</strong></p>
  <pre class="lang-dart prettyprint-override"><code>    static Future&lt;List?&gt; fetchPlans(int value) async {
      var response = await client.get(
          Uri.parse('https://localhost.com/api/users/get_planDetail/'));
      if (response.statusCode == 200) {
        var jsonString = response.body;
        print(jsonString);
        return PlansFromJson(jsonString);
      } else {
        //show error message
        return null;
      }
    }
  </code></pre>
  <p>My plan controller</p>
  <pre class="lang-dart prettyprint-override"><code>    var isLoading = true.obs;
    // ignore: deprecated_member_use
    var plansList = &lt;Plans&gt;[].obs;
    RxInt planId = 0.obs;
    @override
    void onInit() {
      fetchPlans();
      super.onInit();
    }
  
    setPlanId(int id) {
      planId.value = id;
      print(id);
      if (planId.value != 0 &amp;&amp; planId.value != null) {
        fetchPlans();
      }
    }
  
    void fetchPlans() async {
      try {
        isLoading(true);
        var plans = await PlanServices.fetchPlans(planId.value);
        print(plans);
        if (plans != null) {
          plansList.value = plans as List&lt;Plans&gt;;
        }
      } finally {
        isLoading(false);
      }
  
  </code></pre>
  <p><strong>my <code>caregories.dart</code></strong></p>
  <pre class="lang-dart prettyprint-override"><code>     onTap: () {
                          Navigator.push(
                              context,
                              MaterialPageRoute(
                                  builder: (context) =&gt; PlanDetails(
                                      id: categoryController
                                          .categorysList[index].id)));
                        },
  
  </code></pre>
  <p><strong>my <code>plan.dart</code></strong></p>
  <pre class="lang-dart prettyprint-override"><code>     void initState() {
      // call this method for api calling
      planController.setPlanId(widget.id);
      super.initState();
    }
  </code></pre>
  <p>I click ontop to id pass my plan services URL like this <code>https://localhost.com/api/users/get_planDetail/1</code> how to get data</p>