ParamSegment<T> constructor
ParamSegment<T> ({
- required ParamParser parser,
- RouteBuilder<
T> ? create, - List<
Segment< children = const [],T> > - RouteBuilder<
T> ? createError,
Creates a Segment that matches a path segment using the parser
and
injects it into the ParseContext. Usually used with a UintParser.
/// Matches '/users/{id}', where {id} is any non-negative integer as defined
/// by [UintParser].
Segment.param(
parser: const UintParser('id'),
create: (context) => context['id'] as String,
),
See also:
- UintParser, for when you need to parse an id
Implementation
ParamSegment({
required ParamParser parser,
RouteBuilder<T>? create,
List<Segment<T>> children = const [],
RouteBuilder<T>? createError,
}) : super(parser, create, createError, children);