NavigationStackRouterInformationParser<T> class
abstract
Base class to build a URL parser from and to the NavigationStack. The only unimplemented methods are:
- pathSegmentsForItem, that is called in order to build URL components from given stack item;
- itemForPathSegments, that is called in order to get a stack item from a bunch of URL segments.
This parser takes an increasingly large chunk of URL segments to convert (starting from pathSegmentsChunkStartSize and going up until pathSegmentsChunkMaxSize). It passes every chunk to itemForPathSegments. If itemForPathSegments is able to get a stack item, it goes on. Otherwise the URL construction is aborted. You could alse override itemsForRouteInformation to able to implement further checks on the built URL. On the other way around, the parser takes each stack items and invokes pathSegmentsForItem. The segments are then joined together to create the final URL.
- Inheritance
-
- Object
- RouteInformationParser<
NavigationStack< T> > - NavigationStackRouterInformationParser
Constructors
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- pathSegmentsChunkMaxSize → int?
-
When parseRouteInformation examines the incoming URI, it takes an increasingly large chunk of segments to
inspect. This number is the maximum size. If it's null, it means there is no limit
By default it's null. This number must be greater than 0, if not null.
final
- pathSegmentsChunkStartSize → int
-
When parseRouteInformation examines the incoming URI, it takes an increasingly large chunk of segments to
inspect. This number is the base size.
By default it's 1. This number must be greater than 0.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
itemForPathSegments(
List< String> pathSegments) → Future<T?> -
Returns navigation item for given
pathSegments
. You should return null if givenpathSegments
cannot be parsed to a meaningful item. This method could be invoked by itemsForRouteInformation multiple times with an increasing number of segments. -
itemsForRouteInformation(
RouteInformation routeInformation) → Future< List< T> > -
Returns navigation items for incoming
routeInformation
. Default implementation takes the URI and explores its segments. It begins taking the first pathSegmentsChunkStartSize segments and asks to itemForPathSegments if it is able to create a navigation item. If it's not, it adds another segment to the chunk it passes to itemForPathSegments. At maximum, it takes pathSegmentsChunkMaxSize, if not null. You may want to override this method if you want to provide an extra validation step to the created URI (e.g.: you want to check if succession of segments has sense or you want to prepend some implicit navigation item). -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
parseRouteInformation(
RouteInformation routeInformation) → Future< NavigationStack< T> > -
Converts the given route information into parsed data to pass to a
RouterDelegate.
override
-
parseRouteInformationWithDependencies(
RouteInformation routeInformation, BuildContext context) → Future< NavigationStack< T> > -
Converts the given route information into parsed data to pass to a
RouterDelegate.
inherited
-
pathSegmentsForItem(
T item) → List< String> ? -
Returns path segments for given navigation
item
. If you return null, it means you want to add an empty segment. For example, if you want to convert afoo
item withid=1
tofoo/1
, you need to return["foo", "1"]
. -
restoreRouteInformation(
NavigationStack< T> configuration) → RouteInformation -
Restore the route information from the given configuration.
override
-
toString(
) → String -
A string representation of this object.
inherited
-
uriForConfiguration(
NavigationStack< T> configuration) → Uri -
Converts the given
configuration
to an Uri instance. Default implementation calls pathSegmentsForItem for each navigation item, then assembles the URI.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited