Skip to main content

๐Ÿงฉ GoRouter Modular

๐Ÿš€ Modular Flutter Development

Build scalable Flutter applications with dependency injection, event-driven communication, and seamless routing.

Contributors

Made with contrib.rocks


โšก Quick Startโ€‹

flutter pub add go_router_modular
pubspec.yaml
dependencies:
flutter:
sdk: flutter
go_router_modular: ^any

โœจ Why Choose GoRouter Modular?โ€‹

๐Ÿงฉ Modular Architectureโ€‹

Organize your Flutter app into independent, reusable modules with clear boundaries and responsibilities.

See Example ๐Ÿ‘†
๐Ÿ“ lib/src/modules/
๐Ÿ“ auth/ - Authentication features
๐Ÿ“ home/ - Home screen and features
๐Ÿ“ profile/ - User profile management
๐Ÿ“ shared/ - Common services

๐Ÿ’‰ Dependency Injectionโ€‹

Per-module DI with auto-dispose and lifecycle management. Easy testing with mock dependencies.

See Example ๐Ÿ‘†
// Inject dependencies
final controller = context.read<HomeController>();
final service = Modular.get<ApiService>();

// Different binding types
Bind.singleton<ApiService>((i) => ApiService()),
Bind.factory<Repository>((i) => Repository()),
Bind.lazySingleton<Database>((i) => Database()),

๐Ÿ›ฃ๏ธ GoRouter Integrationโ€‹

Seamless integration with declarative, type-safe navigation in your Flutter app.

See Example ๐Ÿ‘†
// Navigate between modules
context.go('/user/123');
context.push('/modal');

// With parameters
context.go('/search?q=flutter');

// Module routes
ModuleRoute('/auth', module: AuthModule()),
ModuleRoute('/user', module: UserModule()),

๐ŸŽญ Event Systemโ€‹

Event-driven communication between modules. Perfect for micro frontend architectures.

See Example ๐Ÿ‘†
// Fire events from anywhere
modularEvent.fire(UserLoggedInEvent(user: user));

// Listen in modules
on<UserLoggedInEvent>((event, context) {
// Handle user login across modules
});

๐ŸŽฏ Custom Loadersโ€‹

Built-in loading system with customizable indicators during module transitions.

See Example ๐Ÿ‘†
// Automatic loading during navigation
ModularLoader.show();
ModularLoader.hide();

// Custom loader design
class MyLoader extends CustomModularLoader {

Widget get child => MySpinner();
}

โšก Hot Reload Friendlyโ€‹

Fast development with instant feedback. Dependencies persist across hot reloads.

Benefits ๐Ÿ‘†
  • ๐Ÿ”ฅ State preserved during development
  • โšก Instant UI updates
  • ๐Ÿงช Easy debugging and testing
  • ๐Ÿš€ Faster development cycle

๐Ÿ—๏ธ Architecture Overviewโ€‹


๐ŸŽญ Perfect for Micro Frontendsโ€‹

๐Ÿš€ Teams Working Independentlyโ€‹

Build applications where different teams work on different features without conflicts:

๐Ÿ›’
Cart Team
Manages cart logic and UI
๐Ÿ’ณ
Payment Team
Handles payment processing
๐Ÿ“ฆ
Product Team
Manages product catalog
๐Ÿ””
Notification Team
Handles all notifications

All teams communicate through events without tight coupling! ๐ŸŽฏ


๐Ÿ“š Learning Pathsโ€‹

๐Ÿš€ I'm New to Modular

Start with our step-by-step tutorial that builds a complete app from scratch.

๐Ÿ’‰ I Want to Learn DI

Understand dependency injection patterns and best practices.

๐ŸŽญ I Need Module Communication

Learn about event-driven architecture and micro frontends.


๐Ÿ’™ Community & Supportโ€‹

โญ
Star on GitHub
Show your support
๐Ÿ“ฆ
pub.dev
Latest version
๐Ÿ›
Report Issues
Get help & feedback
๐Ÿ“–
Documentation
Learn & explore

๐Ÿš€ Ready to build something amazing?

Join thousands of developers building scalable Flutter applications with GoRouter Modular