Uri.http constructor Null safety
Creates a new http
URI from authority, path and query.
Examples:
// http://example.org/path?q=dart.
new Uri.http("example.org", "/path", { "q" : "dart" });
// http://user:pass@localhost:8080
new Uri.http("user:pass@localhost:8080", "");
// http://example.org/a%20b
new Uri.http("example.org", "a b");
// http://example.org/a%252F
new Uri.http("example.org", "/a%2F");
The scheme
is always set to http
.
The userInfo
, host
and port
components are set from the
authority
argument. If authority
is null
or empty,
the created Uri
has no authority, and isn't directly usable
as an HTTP URL, which must have a non-empty host.
The path
component is set from the unencodedPath
argument. The path passed must not be encoded as this constructor
encodes the path.
The query
component is set from the optional queryParameters
argument.
Implementation
factory Uri.http(String authority, String unencodedPath,
[Map<String, String>? queryParameters]) = _Uri.http;