go_router_modular 4.0.0+4 copy "go_router_modular: ^4.0.0+4" to clipboard
go_router_modular: ^4.0.0+4 copied to clipboard

go_router wrapper with a modular twist dependency injections and automatic dispose

🧩 GoRouter Modular πŸ’‰ #

Simplifying Flutter development with modular architecture #

Pub Version GitHub Stars License

GoRouter Modular simplifies Flutter development by implementing a modular architecture with GoRouter for route management 🧩 and supports per-module dependency injection with auto-dispose πŸ’‰.

Perfect for micro frontends and large-scale applications! πŸš€



✨ Key Features #

  • 🧩 Modular Architecture - Independent, reusable modules
  • πŸ’‰ Dependency Injection - Built-in DI with auto-dispose
  • πŸ›£οΈ GoRouter Integration - Type-safe and declarative navigation
  • 🎭 Event System - Event-driven communication between modules
  • πŸš€ Performance - Lazy loading and efficient memory management
  • πŸ›‘οΈ Type Safety - Fully type-safe with compile-time error detection

⚑ Quick Start #


🧩 Module Example #

class HomeModule extends Module {
  @override
  FutureOr<List<Bind<Object>>> binds() => [
    Bind.singleton<HomeController>((i) => HomeController()),
  ];

  @override
  List<ModularRoute> get routes => [
    ChildRoute('/', child: (context, state) => HomePage()),
    ChildRoute('/profile', child: (context, state) => ProfilePage()),
  ];
}

🎭 Event System #

class NotificationModule extends EventModule {
  @override
  void listen() {
    on<ShowNotificationEvent>((event, context) {
      if (context != null) {
        ScaffoldMessenger.of(context).showSnackBar(
          SnackBar(content: Text(event.message)),
        );
      }
    });
  }
}

// Fire event
ModularEvent.fire(ShowNotificationEvent('Hello!'));

πŸ›£οΈ Navigation Examples #

Basic Navigation #

// Navigate to a route
context.go('/profile');

// Push a new route
context.push('/settings');

// Go back
context.pop();
// Navigate with path parameters
context.go('/user/123');

// Navigate with query parameters
context.go('/search?q=flutter&category=all');

// Navigate with extra data
context.go('/product', extra: {'id': 456, 'name': 'Flutter Book'});

Async Navigation #

ElevatedButton(
  onPressed: () async {
    // Show loading
    ModularLoader.show();
    
    // Perform async operation
    await Future.delayed(Duration(seconds: 2));
    
    // Navigate
    await context.goAsync('/heavy-page');
    
    // Hide loading
    ModularLoader.hide();
  },
  child: Text('Navigate with Loading'),
),


πŸŽ‰ Happy Coding with GoRouter Modular! πŸŽ‰ #

Transform your Flutter app into a scalable, modular masterpiece ✨

Contributors

Made with contrib.rocks

31
likes
0
points
700
downloads

Publisher

unverified uploader

Weekly Downloads

go_router wrapper with a modular twist dependency injections and automatic dispose

Homepage
Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

event_bus, flutter, go_router

More

Packages that depend on go_router_modular