buildCanonicalQueryString static method
Implementation
static String buildCanonicalQueryString(Map<String, String>? queryParams) {
if (queryParams == null) {
return '';
}
final sortedQueryParams = [];
queryParams.forEach((key, value) {
sortedQueryParams.add(key);
});
sortedQueryParams.sort();
final canonicalQueryStrings = [];
for (var key in sortedQueryParams) {
canonicalQueryStrings.add(
'$key=${Uri.encodeQueryComponent(queryParams[key]!).replaceAll('+', "%20")}');
}
return canonicalQueryStrings.join('&');
}