auto_go_route 1.0.8
auto_go_route: ^1.0.8 copied to clipboard
A powerful, type-safe, and feature-rich routing package for Flutter GoRouter with automatic code generation.
// lib/main.dart
import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';
import 'package:provider/provider.dart';
import 'src/app_router.dart';
import 'src/auth_service.dart';
// Initialize services
final authService = AuthService();
final appRouter = AppRouter(authService: authService);
void main() {
WidgetsFlutterBinding.ensureInitialized();
runApp(
ChangeNotifierProvider.value(
value: authService,
child: MyApp(router: appRouter.router),
),
);
}
class MyApp extends StatelessWidget {
final GoRouter router;
const MyApp({super.key, required this.router});
@override
Widget build(BuildContext context) {
return MaterialApp.router(
title: 'AutoGoRoute Example',
theme: ThemeData(
primarySwatch: Colors.deepPurple,
useMaterial3: true,
brightness: Brightness.dark,
scaffoldBackgroundColor: const Color(0xFF121212),
cardColor: const Color(0xFF1E1E1E),
appBarTheme: const AppBarTheme(
backgroundColor: Color(0xFF1E1E1E),
elevation: 0,
),
bottomNavigationBarTheme: const BottomNavigationBarThemeData(
backgroundColor: Color(0xFF1E1E1E),
selectedItemColor: Colors.deepPurpleAccent,
unselectedItemColor: Colors.grey,
),
),
routerConfig: router,
debugShowCheckedModeBanner: false,
);
}
}