wyatt_go_router (1.0.0)

Published 2023-11-14 17:37:15 +00:00 by hugo in Wyatt-FOSS/wyatt-packages

Installation

dart pub add wyatt_go_router:1.0.0 --hosted-url=

About this package

GoRouter Enhancements.

Flutter - Wyatt Go Router

Style: Wyatt Analysis SDK: Flutter

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;
Details
Pub
2023-11-14 17:37:15 +00:00
231
16 KiB
Assets (1)
1.0.0.tar.gz 16 KiB
Versions (1) View all
1.0.0 2023-11-14