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