Host class final
An HTTP host reference per RFC 3986 section 3.2.2, used by Host headers,
the Domain attribute of cookies, and the host=/for= values in
Forwarded.
host = IP-literal / IPv4address / reg-name
IP-literal = "[" ( IPv6address / IPvFuture ) "]"
On the wire an IPv6 host is bracketed. In a Host instance the brackets
are not stored on the host field; the wire form is produced by encode,
which adds brackets when host contains : (IPv6 / IPvFuture).
port is the optional explicit port (uri-host [ ":" port ]). An absent
port is represented by null; this is distinct from a default port (80,
443, ...) which the fromUri factory takes care to preserve.
- Annotations
Constructors
- Host(String host, [int? port])
- Creates a Host from its parts.
- Host.fromUri(Uri uri)
-
Creates a Host from a Uri, honoring
Uri.hasPortso that an implicit default port is left asnullrather than coerced to 80/443.factory - Host.parse(String source)
-
Parses
sourceasuri-host [ ":" port ].factory
Properties
- hashCode → int
-
The hash code for this object.
no setteroverride
- host → String
-
The host literal without IPv6 brackets. For example:
example.com,192.0.2.1,::1. Case is preserved as supplied; equality is ASCII case-insensitive.final - port → int?
-
The explicit port, or
nullwhen no port was supplied.final - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
encode(
) → String -
The wire form:
uri-host [ ":" port ], adding IPv6 brackets when host contains a colon. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
override