Segment<T>.param constructor
Segment<T>.param ({
- required ParamParser parser,
- RouteBuilder<
T> ? create, - List<
Segment< children,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
factory Segment.param({
required ParamParser parser,
RouteBuilder<T>? create,
List<Segment<T>> children,
RouteBuilder<T>? createError,
}) = ParamSegment<T>;