UriParser class
Parsable templates have the following restrictions over expandable templates:
- URI components must come in order: scheme, host, path, query, fragment, and there can only be one of each.
- Path expressions can only contain one variable, and multiple expressions must be separated by a literal
- Only the following operators are supported: default, +, #, ?, &
- default and + operators are not allowed in query or fragment components
- Queries can only use the ? or & operator. The ? operator can only be used once.
- Fragments can only use the # operator
By default, fragments are treated as patchs and prefix-matched. This means
that the template '#foo' will match against the fragments #foo
, and
#foo/bar
, but not #foobar
. This is to facilitate hierarchical matching
in client-side routing applications, a likely use case, since fragments are
not usually available to servers. You can turn off fragment prefix-matching
with the fragmentPrefixMatching
construtor parameter.
- Inheritance
-
- Object
- UriPattern
- UriParser
Constructors
- UriParser(UriTemplate template, {bool fragmentPrefixMatching = true, bool queryParamsAreOptional = false})
Properties
- fragmentRegex → RegExp?
-
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- pathRegex → RegExp?
-
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- template → UriTemplate
-
final
Methods
-
expand(
Map< String, Object> parameters) → Uri -
Returns the Uri generated by this pattern for the given
parameters
.override -
match(
Uri uri) → UriMatch? -
Returns a UriMatch describing the match if
uri
is matched by this pattern, otherwise returnsnull
.override -
matches(
Uri uri) → bool -
Returns
true
ifuri
is matched by this pattern.inherited -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
parse(
Uri uri) → Map< String, String> -
Parses
uri
returning the parameter values in a map keyed by the variable names in the template. -
toString(
) → String -
A string representation of this object.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited