GoRouterHelper extension

Dart extension to add navigation function to a BuildContext object, e.g. context.go('/');

on

Methods

canPop() bool
Returns true if there is more than 1 page on the stack.
go(String location, {Object? extra}) → void
Navigate to a location.
goNamed(String name, {Map<String, String> pathParameters = const <String, String>{}, Map<String, dynamic> queryParameters = const <String, dynamic>{}, Object? extra}) → void
Navigate to a named route.
namedLocation(String name, {Map<String, String> pathParameters = const <String, String>{}, Map<String, dynamic> queryParameters = const <String, dynamic>{}}) String
Get a location from route name and parameters.
pop<T extends Object?>([T? result]) → void
Pop the top page off the Navigator's page stack by calling Navigator.pop.
push<T extends Object?>(String location, {Object? extra}) Future<T?>
Push a location onto the page stack.
pushNamed<T extends Object?>(String name, {Map<String, String> pathParameters = const <String, String>{}, Map<String, dynamic> queryParameters = const <String, dynamic>{}, Object? extra}) Future<T?>
Navigate to a named route onto the page stack.
pushReplacement(String location, {Object? extra}) → void
Replaces the top-most page of the page stack with the given URL location w/ optional query parameters, e.g. /family/f2/person/p1?color=blue.
pushReplacementNamed(String name, {Map<String, String> pathParameters = const <String, String>{}, Map<String, dynamic> queryParameters = const <String, dynamic>{}, Object? extra}) → void
Replaces the top-most page of the page stack with the named route w/ optional parameters, e.g. name='person', pathParameters={'fid': 'f2', 'pid': 'p1'}.
replace(String location, {Object? extra}) → void
Replaces the top-most page of the page stack with the given one but treats it as the same page.
replaceNamed(String name, {Map<String, String> pathParameters = const <String, String>{}, Map<String, dynamic> queryParameters = const <String, dynamic>{}, Object? extra}) → void
Replaces the top-most page with the named route and optional parameters, preserving the page key.