Segment<T> class
abstract
Represents a single node in a route tree.
T
is the type of objects that get returned on routing to a path.
It could be Widget or some kind of RouteHandler
Constructors
-
Segment(SegmentParser parser, RouteBuilder<
T> ? create, RouteBuilder<T> ? createError, List<Segment< children)T> > - Public default constructor called by implementing classes
-
Segment.param({required ParamParser parser, RouteBuilder<
T> ? create, List<Segment< children, RouteBuilder<T> >T> ? createError}) -
Creates a Segment that matches a path segment using the
parser
and injects it into the ParseContext. Usually used with a UintParser.factory -
Segment.path({required String name, RouteBuilder<
T> ? create, List<Segment< children, RouteBuilder<T> >T> ? createError}) -
Creates a path segment that matches a segment literally like /settings,
/user, etc
factory
-
Segment.regExpParam({required RegExpParamParser parser, RouteBuilder<
T> ? create, List<Segment< children, RouteBuilder<T> >T> ? createError}) -
Creates a Segment that matches a path segment against a regular
expression and adds it to the ParseContext.
factory
-
Segment.regExpPath({required RegExp regExp, RouteBuilder<
T> ? create, List<Segment< children, RouteBuilder<T> >T> ? createError}) -
Creates a Segment that matches a path segment against a regular
expression.
factory
Properties
-
children
→ Iterable<
Segment< T> > -
no setter
-
create
→ RouteBuilder<
T> ? -
Creates an instance of
T
, called when the Segment that owns this callback is routed to.final -
createError
→ RouteBuilder<
T> ? -
If Segment.parse cannot find a matching route the bottom most
createError is called instead.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- parser → SegmentParser
-
The parser that handles whether this Segment matches a route.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
parse(
ParseContext< T> context, Iterable<String> segments, RouteBuilder<T> createError) → Result<T, T> ? -
Returns a
Result<T, T>?
where null means this doesn't match the current path segment,Result.ok
means a match was found andResult.err
means an error was encountered trying to parse the path segments. -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
root<
T> ({RouteBuilder< T> ? create, required RouteBuilder<T> createError, List<Segment< children = const [], List<T> >SegmentVerifier< verifiers = const [findConflictingParamKeys]}) → RootSegment<T> >T> - Creates a RootSegment