plug_router_helper library
Optional GoRouter redirect helpers.
The route definitions live in plug_location_map.dart (exported as
PlugRoutes, PlugRouteExtra, and plugLocationRoutes). This file adds
redirect helpers you can call from your GoRouter redirect: callback to
bounce users to the no-location page when permission/GPS is missing.
import 'package:plug_location_map/plug_location_map.dart';
import 'package:plug_location_map/plug_router_helper.dart';
final router = GoRouter(
redirect: (context, state) {
final container = ProviderScope.containerOf(context);
return plugRedirectFromContainer(container);
},
routes: [
GoRoute(path: '/', builder: (c, s) => const HomePage()),
...plugLocationRoutes(),
],
);
Functions
-
plugRedirect(
WidgetRef ref) → String? -
Use inside a GoRouter
redirect:callback that has aWidgetRef. -
plugRedirectFromContainer(
ProviderContainer c) → String? -
Use inside a GoRouter
redirect:callback with aProviderContainer(e.g. obtained viaProviderScope.containerOf(context)).