addParameters method

Uri addParameters(
  1. Map<String, dynamic>? parameters
)

Returns a new Uri instance based on this and adds parameters.

Implementation

Uri addParameters(Map<String, dynamic>? parameters) {
  if (parameters == null) return this;

  String paramUrl = origin + path;

  Map<String, dynamic> newParameters = {};

  queryParametersAll.forEach((key, values) {
    newParameters[key] = values;
  });

  parameters.forEach((key, value) {
    newParameters[key] = value;
  });

  return buildUrlString(paramUrl, newParameters).toUri();
}