flutter_modular
7.1.1, released 2 months ago by flutterando.com.br
Modular route management and dependency injection organized by feature.
WASM-ready
What it does
Flutter Modular organizes Flutter applications into feature-based modules, combining route management and dependency injection. It allows scoping dependencies and routes per feature, supporting named routes, nested routers, and route guards.
AI-written summary of version 7.1.1, based on the package's README and metadata. Report an inaccuracy
Use it when
- You want to structure a large-scale Flutter application by features or modules.
- You need nested routing with persistent shells using RouterOutlet.
- You want integrated dependency injection tied to route lifecycles.
Skip it when
- You are building a tiny app where a standard MaterialApp navigation setup is sufficient.
- You prefer completely decoupled state management and routing solutions.
Strengths
- Combines dependency injection and routing cleanly into modules.
- Automatic disposal of page-scoped state tied to route lifecycles.
- Supports dynamic parameters, submodules, and route guards.
Weaknesses
- Opinionated structure that requires adopting its module pattern across the app.
- Ground-up rewrite in v7 may require migration effort from older versions.
Setup
- Kind
- Flutter widgets
- Effort
- Medium
- Code generation
- No
- Direct dependencies
- 3
Wrap your root widget with ModularApp and configure MaterialApp.router to use the routerConfig.
import 'package:flutter_modular/flutter_modular.dart';
final appModule = createModule(register: (c) {
c
..route('/', child: (ctx, state) => const HomePage());
});
void main() => runApp(ModularApp(module: appModule, child: const AppRoot()));Alternatives
Packages that do the same job and could replace flutter_modular.
Works with
Packages commonly used together with flutter_modular: ones it builds on, ones built on it, and its own family.
- webflutter_modular depends on itLightweight bindings for browser APIs via JS interop
- auto_injectorflutter_modular depends on itAutomatic dependency injection system for Dart and Flutter without build_runner.
- modular_coreSame familyInjection system and routes for flutter_modular and shelf_modular
- vadenSame familyA Dart backend framework inspired by Spring Boot, using annotations for controllers, DI, and OpenAPI docs.