Modular Routing and Dependency Injection for Flutter with GoRouter. Features event-driven architecture for seamless module communication and micro-frontend support.
Package selection guidance compiled from public package information, community data, and project usage.
GoRouter Modular is a Flutter package that enhances GoRouter with modular routing and dependency injection, enabling scalable app architecture. It supports event-driven communication between modules and facilitates micro-frontend patterns. Designed for large-scale applications, it promotes code separation, reusability, and independent module development. The package integrates seamlessly with GoRouter while extending its capabilities for complex navigation and state management across modular components.
Use cases
Large-scale Flutter applications
Micro-frontend architectures
Modular app development
Independent module deployment
Event-driven inter-module communication
Scalable navigation systems
Key features
Modular routing with GoRouter
Built-in dependency injection
Event-driven module communication
Support for micro-frontends
Easy module integration
Cross-platform compatibility
Suitable for
Developers building complex Flutter apps
Teams using modular architecture
Projects requiring reusable UI components
Apps with multiple feature modules
Engineering teams prioritizing scalability
Considerations
Requires understanding of GoRouter
Steeper learning curve for beginners
Additional setup for module registration
May increase build complexity
Best suited for larger projects over small apps
Original README
Original README snapshot from the linked source repository. Visit the repository for the latest content.
🧩 GoRouter Modular 💉
Modular architecture, dependency injection & route management on top of GoRouter.
GoRouter Modular brings a modular architecture on top of GoRouter, with per-module dependency injection and automatic dispose. Split a large app into independent, lazy-loaded feature modules — perfect for micro frontends and scalable, team-friendly codebases. 🚀
💡 Inspired by flutter_modular by Flutterando — we're grateful for their contribution to the Flutter ecosystem.
✨ Features
🧩 Modular Architecture
Independent, reusable feature modules
💉 Dependency Injection
Built-in DI with automatic dispose
🛣️ GoRouter Integration
Type-safe, declarative navigation
🎭 Event System
Decoupled, event-driven communication between modules
🚀 Lazy Loading
Modules load on demand with efficient memory management
context.goNamed('profile'); // replace the stack
context.pushNamed('home'); // push on topfinal controller = Modular.get<HomeController>(); // resolve a dependency
🤖 Agent Skill
This repo ships an Agent Skill that teaches AI coding agents (Claude Code, Cursor, Codex, OpenCode, and others) the recommended conventions for this package — per-feature route files, named-only navigation, typed binds via the .. cascade, synchronous modules, and kDebugMode-gated logs. The agent then applies them automatically when you scaffold routes, modules, or navigation.
Install it into your project with one command (via the skills CLI):
The CLI detects your installed agents and drops the skill into the right place (e.g. .claude/skills/). Add -g to install it globally for every project.
Optional — events add-on
If your app uses the event system (EventModule, ModularEvent, ModularEventMixin) for decoupled cross-module communication, install the separate events skill too: