query property

Map<String, String?> get query

Query parameters to be appended to the route.

class MyRouteData extends SimpleRouteData {
  const MyRouteData(this.redirect);

  final String? redirect;

  @override
  Map<String, String?> get query => {
    // The value of `redirect`, if not null, will be
    // appended to the route as a URI-encoded query
    // parameter, using the `redirect` key.
    // e.g. `?redirect=/home`
    'redirect': redirect,
  };
}

If the value is null or empty, the query parameter will not be appended.

These values can be accessed directly on the GoRouterState.uri.queryParameters map.

Implementation

Map<String, String?> get query => const {};