Skip to content

[go_router] Provides a way to access current route data in a widget subtree. #110858

@chunhtai

Description

@chunhtai

Currently there is no API to get the current route information such as query parameter, path, or path parameter in a widget subtree underneath the page. Ideally go_router should provide a inherited widget or some sort to allow user to get GoRouteState or GoRouteMatch from the current context. for example

@override
Widget build(BuildContext context) {
  final GoRouteState state = GoRouteState.of(context);
  return Text('The location is ${state.location}');
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3Issues that are less important to the Flutter projectc: new featureNothing broken; request for a new capabilityp: go_routerThe go_router packagepackageflutter/packages repository. See also p: labels.

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions