Skip to content

Uri with empty queryParameter has an extra ? at the end #122089

@ValentinVignal

Description

@ValentinVignal

A Uri with empty queryParameters (= {}) will have a ? at the end even it doens't have any query parameters

Steps to Reproduce

  1. Execute flutter run on the code sample (see "Code sample" section below)
  2. Notice that the uri finishes with a ? but has no query parameters.

Expected results:

I would expect the uri to be /path

Actual results:

The uri is /path?

Code sample
void main() {
  final uri = Uri(path: '/path', queryParameters: {});
  print(uri);
}
Logs
/path?

Metadata

Metadata

Assignees

No one assigned

    Labels

    r: invalidIssue is closed as not valid

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions