I have a simple Controller to load Json Api data. As you can see, there are parameters that are attached to the Api Call URL. Now the parameters are static.

class RadioApi {
  final endPointUrl = "someApiUrl.com";
  final client = http.Client();

  Future<List<Article>> getArticle() async {
    final queryParameters = {
      'sort_by': 'popularity.desc',
      'item_id': '3',
      'category': '44',
      'api_key': 'fea4e663549ede6fe6fe6f3f79fb2a3e'
    };
    final uri = Uri.https(endPointUrl, '/flutterRadioApp/myjsonradio.php/', queryParameters);
    final response = await client.get(uri);

    Map<String, dynamic> json = jsonDecode(response.body);

    List<dynamic> body = json['results'];
    List<Article> articles =
        body.map((dynamic item) => Article.fromJson(item)).toList();
    return articles;
  }
}

I also have some widgets that use this controller. The goal is for me to be able to specify these parameters in each widget separately. So first one for example with 'sort_by': 'popularity.desc', and second one: 'sort_by': 'popularity.asc'.

class ListViewWidget extends StatelessWidget {

  RadioApi client = RadioApi();

  @override
  Widget build(BuildContext context) {

    return Container(

      child: FutureBuilder(
        future: client.getArticle(),
        builder: (BuildContext context, AsyncSnapshot<List<Article>> snapshot) {
          List<Widget> children;
          if (snapshot.hasData) {
            List<Article>? articles = snapshot.data;
            return ListView.builder(
                scrollDirection: Axis.vertical,
                shrinkWrap: true,
                physics: const NeverScrollableScrollPhysics(),
                itemCount: articles!.length,
                itemBuilder: (context, index) =>
                    VerticalList(articles[index], context));
          } else if (snapshot.hasError) {
            return Center(
              child: Text(snapshot.error.toString(),
                  style: const TextStyle(
                      color: Colors.white,
                      fontSize: 18,
                      fontWeight: FontWeight.bold)),
            );
          } else {
            return const Center(
              child: CircularProgressIndicator(),
            );
          }
        },
      ),
    );
  }
}

Please Help. Thanks.