Uri class

A parsed URI, such as a URL.

A parsed URI, such as a URL.

See also:

Constructors

Uri({String scheme: "", String userInfo: "", String host, int port, String path, Iterable<String> pathSegments, String query, Map<String,String> queryParameters, String fragment})
Creates a new URI from its components.
Uri.http(String authority, String unencodedPath, [Map<String,String> queryParameters])
Creates a new http URI from authority, path and query.
Uri.https(String authority, String unencodedPath, [Map<String,String> queryParameters])
Creates a new https URI from authority, path and query.
Uri.file(String path, {bool windows})
Creates a new file URI from an absolute or relative file path.
Uri.directory(String path, {bool windows})
Like Uri.file except that a non-empty URI path ends in a slash.

Static Properties

base Uri
read-only

Static Methods

parse(String uri, [int start = 0, int end]) → Uri
Creates a new Uri object by parsing a URI string.
encodeComponent(String component) → String
Encode the string component using percent-encoding to make it safe for literal use as a URI component.
encodeQueryComponent(String component, {Encoding encoding: UTF8}) → String
Encode the string component according to the HTML 4.01 rules for encoding the posting of a HTML form as a query string component.
decodeComponent(String encodedComponent) → String
Decodes the percent-encoding in encodedComponent.
decodeQueryComponent(String encodedComponent, {Encoding encoding: UTF8}) → String
Decodes the percent-encoding in encodedComponent, converting pluses to spaces.
encodeFull(String uri) → String
Encode the string uri using percent-encoding to make it safe for literal use as a full URI.
decodeFull(String uri) → String
Decodes the percent-encoding in uri.
splitQueryString(String query, {Encoding encoding: UTF8}) → Map<String,String>
Returns the query split into a map according to the rules specified for FORM post in the HTML 4.01 specification section 17.13.4. Each key and value in the returned map has been decoded. If the query is the empty string an empty map is returned.
parseIPv4Address(String host) → List<int>
Parse the host as an IP version 4 (IPv4) address, returning the address as a list of 4 bytes in network byte order (big endian).
parseIPv6Address(String host, [int start = 0, int end]) → List<int>
Parse the host as an IP version 6 (IPv6) address, returning the address as a list of 16 bytes in network byte order (big endian).

Instance Properties

scheme String
read-only
Returns the scheme component.
authority String
read-only
userInfo String
read-only
host String
read-only
port int
read-only
path String
read-only
query String
read-only
fragment String
read-only
pathSegments List<String>
read-only
queryParameters Map<String,String>
read-only
isAbsolute bool
read-only
hasAuthority bool
read-only
hasPort bool
read-only
hasQuery bool
read-only
hasFragment bool
read-only
origin String
read-only
hashCode int
read-only

Instance Methods

replace({String scheme, String userInfo, String host, int port, String path, Iterable<String> pathSegments, String query, Map<String,String> queryParameters, String fragment}) → Uri
Returns a new Uri based on this one, but with some parts replaced.
normalizePath() → Uri
Returns an URI where the path has been normalized.
resolve(String reference) → Uri
Resolve reference as an URI relative to this.
resolveUri(Uri reference) → Uri
Resolve reference as an URI relative to this.
toFilePath({bool windows}) → String
Returns the file path from a file URI.
toString() → String
Returns a string representation of this object.

Operators

operator ==(other) → bool
The equality operator.