go_router_guards 2.0.0+2 copy "go_router_guards: ^2.0.0+2" to clipboard
go_router_guards: ^2.0.0+2 copied to clipboard

A flexible and extensible guard system for Go Router that allows you to chain multiple guards together for route protection.

example/lib/main.dart

// Copyright 2025 Tomás Sasovsky
// Use of this source code is governed by a MIT-style license that can be
// found in the LICENSE file.

import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:simple_example/app_router.dart';
import 'package:simple_example/cubit/auth_cubit.dart';
import 'package:simple_example/cubit/user_cubit.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MultiBlocProvider(
      providers: [
        BlocProvider(create: (context) => AuthCubit()),
        BlocProvider(create: (context) => UserCubit()),
      ],
      child: MaterialApp.router(
        title: 'Go Router Guards - Simple Example',
        theme: ThemeData(
          colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
          useMaterial3: true,
        ),
        routerConfig: router,
        debugShowCheckedModeBanner: false,
      ),
    );
  }
}
0
likes
160
points
4
downloads

Publisher

verified publisheraquiles.dev

Weekly Downloads

A flexible and extensible guard system for Go Router that allows you to chain multiple guards together for route protection.

Repository (GitHub)
View/report issues
Contributing

Documentation

API reference

License

MIT (license)

Dependencies

flutter, go_router, meta

More

Packages that depend on go_router_guards