Request class

The Request Facade.

Access request data like route parameters, query strings, and (eventually) form input from anywhere in your application.

Route Parameters

For a route /users/:id navigating to /users/42:

final userId = Request.route('id'); // '42'

Query Parameters

For a URL /search?q=flutter&page=2:

final query = Request.query('q');     // 'flutter'
final page = Request.query('page');   // '2'

All Parameters

final allRouteParams = Request.routeParams;
final allQueryParams = Request.queryParams;

Properties

hashCode int
The hash code for this object.
no setterinherited
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
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Properties

queryParams Map<String, String>
Get all query parameters as a Map.
no setter
routeParams Map<String, String>
Get all path parameters as a Map.
no setter

Static Methods

all() Map<String, String>
Get all parameters (route + query) merged.
has(String key) bool
Check if a parameter exists (in route or query).
input(String key) String?
Get a parameter from either route or query.
query(String key) String?
Get a query parameter from the current URL.
route(String key) String?
Get a path parameter from the current route.