UrlState class
UrlState Holds current url state in a more structured way it's used by Router as configuration state
- Annotations
Constructors
-
UrlState(Uri uri, List<
RouteMatch> segments, {bool shouldReplace = false, Object? pathState}) -
Default constructor
const
-
UrlState.fromSegments(List<
RouteMatch> routes, {bool shouldReplace = false, Object? state}) -
Builds UrlState from list of
route matches instead of uri
factory
Properties
- flatten → UrlState
-
Returns a new instance of UrlState
With the flattened version of segments
e.g if segments = [Match1[Match2
Match3
]] the result isMatch1,Match2,Match3
no setter - hashCode → int
-
The hash code for this object.
no setteroverride
- hasSegments → bool
-
Returns true if segments is not empty
no setter
- path → String
-
Returns the path of uri
no setter
- pathState → Object?
-
Holds instance of browser entry-state
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
segments
→ List<
RouteMatch> -
The list of segments representing the current uri
final
- shouldReplace → bool
-
This is passed to AutoRouteInformation.replace
when location is restored
final
- topMatch → RouteMatch?
-
Returns to topMost item in the segments list
Witch is the last
no setter
- uri → Uri
-
Represents current router uri
final
- url → String
-
Returns a fully decoded uri
no setter
Methods
-
childrenOfSegmentNamed(
String routeName) → List< RouteMatch> - re
-
copyWith(
{List< RouteMatch> ? segments, Uri? uri, bool? shouldReplace, Object? pathState}) → UrlState - Returns a new UrlState instance with replaced properties
-
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
Static Methods
-
toHierarchy(
List< RouteMatch> segments) → RouteMatch -
Converts a list of linear route matches to
to a hierarchy of routes
e.g
Match1,Match2,Match3
will be [Match1[Match2Match3
]]