route_tree library

route_tree provides a declarative way of defining routers.

Classes

IntParser
A SegmentParser that matches an integer and injects it into the ParseContext
LiteralParser
SegmentParser that matches a String literally with String.operator==.
ParamParser<T>
Base class for parsers that inject a key-value pair into the ParseContext
ParamSegment<T>
A Segment for path parameters
ParseContext<T>
The parse state consisting of the uri and parameters injected into it
ParseParamResult
Marker interface for ParseResults that should get injected into a ParseContext
ParseResult
The result of a parse operation, where
PathSegment<T>
A Segment for literal path segments
RegExpParamParser<T>
SegmentParser that matches a segment against the supplied regExp, like RegExpParser, except that it also injects the resulting key-value pair into the ParseContext, which can be queried from Segment.create or Segment.createError.
RegExpParamSegment<T>
A Segment for path segments that should match a regular expression, where you need the segment itself, too.
RegExpParser
SegmentParser that matches a segment against the supplied regExp.
RegExpPathSegment<T>
A Segment for path segments that match a regular expression
RootSegment<T>
There should be only one RootSegment within a route_tree and it should be the root Segment
Segment<T>
Represents a single node in a route tree.
SegmentParser
Handles parsing of single path segments for Segments.
UintParser
A SegmentParser that matches an unsigned integer (like an id) and injects it into the ParseContext

Functions

findConflictingParamKeys<T>(Segment<T> current, String path) → Result<void, String>

Typedefs

Parser = ParseResult Function(ParseContext context, String source)
A function tha defines a predicate by which path segments are matched
RouteBuilder<T> = T Function(ParseContext<T> context)
A function that gets called if its owning Segment matches a path.
SegmentVerifier<T> = Result<void, String> Function(Segment<T> current, String path)
A function that gets called with the RootSegment.
ValueParser = ParseParamResult Function(ParseContext context, String source)
A function that defines a predicate by which path segments are matched and returns a ParseParamResult.

Exceptions / Errors

ValidationError