appendSearchParams method

Uri appendSearchParams(
  1. String key,
  2. String value, [
  3. Uri? url
])

Get new Uri with updated queryParams Uses lists to allow multiple values for the same key

url may be used to update based on a different url than the current one

Implementation

Uri appendSearchParams(String key, String value, [Uri? url]) {
  final searchParams =
      Map<String, dynamic>.from((url ?? _url).queryParametersAll);
  searchParams[key] = [...searchParams[key] ?? [], value];
  return (url ?? _url).replace(queryParameters: searchParams);
}