diff --git a/examples/guards/lib/main.dart b/examples/guards/lib/main.dart index 90db5661..37ae82f7 100644 --- a/examples/guards/lib/main.dart +++ b/examples/guards/lib/main.dart @@ -223,9 +223,9 @@ class MyApp extends StatelessWidget { ], ), guards: [ - // Guard /books/* by beaming to /login if the user is unauthenticated: + // Guard /books and /books/* by beaming to /login if the user is unauthenticated: BeamGuard( - pathBlueprints: ['/books/*'], + pathBlueprints: ['/books', '/books/*'], check: (context, location) => context.read().isAuthenticated, beamToNamed: '/login', diff --git a/package/README.md b/package/README.md index 576f06ec..9ed8c1bb 100644 --- a/package/README.md +++ b/package/README.md @@ -492,9 +492,9 @@ You can define global guards (for example, authentication guard) or location gua ```dart BeamerDelegate( guards: [ - // Guard /books/* by beaming to /login if the user is unauthenticated: + // Guard /books and /books/* by beaming to /login if the user is unauthenticated: BeamGuard( - pathBlueprints: ['/books/*'], + pathBlueprints: ['/books', '/books/*'], check: (context, location) => context.isAuthenticated, beamToNamed: '/login', ), @@ -511,8 +511,8 @@ BeamerDelegate( List get guards => [ // Show forbiddenPage if the user tries to enter books/2: BeamGuard( - pathBlueprints: ['/books/*'], - check: (context, location) => location.pathParameters['bookId'] != '2', + pathBlueprints: ['/books/2'], + check: (context, location) => false, showPage: forbiddenPage, ), ];