createQueryString function

String createQueryString(
  1. Map<String, dynamic> queryParams
)

Implementation

String createQueryString(Map<String, dynamic> queryParams) {
  List<String> keys = queryParams.keys.toList()..sort(); // Get sorted keys

  List<String> queryList = keys.map((key) {
    String encodedValue = Uri.encodeComponent(queryParams[key]!);
    return '$key=$encodedValue';
  }).toList();

  String queryString = queryList.join('&');

  return queryString;
}