- wyatt_analysis@2.7.0 - wyatt_architecture@0.2.0+2 - wyatt_authentication_bloc@0.6.0 - wyatt_cloud_messaging_bloc_base@0.1.1+4 - wyatt_continuous_deployment@1.1.0 - wyatt_form_bloc@0.2.0+5 - wyatt_go_router@1.0.1 - wyatt_http_client@2.0.2 - wyatt_type_utils@0.1.0 - wyatt_ui_components@0.4.0 - wyatt_ui_layout@0.1.3 - wyatt_crud_bloc_firestore@0.2.0+1 - wyatt_crud_bloc@0.2.0+1 - wyatt_i18n@2.0.3 - wyatt_cloud_messaging_bloc_firebase@0.1.0+4 - wyatt_bloc_layout@0.1.2+6 - wyatt_ui_kit@3.2.5
Flutter - Wyatt Go Router
GoRouter Enhancements for Flutter
This package provides a set of utilities to help you use the GoRouter package.
Features
- PageProtection extension to add a protection to a page
- currentRoute method to get the current route anywhere in the app
- GoRouterRefreshStream to refresh the router when needed
- RouteBase flattenization to get a list of all the routes in the router
Usage
If you want to protect a page, you can use the PageProtection extension:
GoRoute(
path: '/sign_in',
...
)..setPublic(),
If you want to get the current route, you can use the currentRoute method:
final route = GoRouter.of(context).currentRoute;
// or
final route = context.currentRoute;
If you want to refresh the router, you can use the GoRouterRefreshStream:
GoRouterRefreshStream(
context.read<AuthenticationCubit<Session>>().stream,
)
If you want to get a list of all the routes in the router, you can use the RouteBase flattenization:
final routes = GoRouter.of(context).flattenedRoutes;