Skip to content
pubscout

flutter_modular

7.1.1, released 2 months ago by flutterando.com.br

Modular route management and dependency injection organized by feature.

WASM-ready
$ flutter pub add flutter_modular
Source repository

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.

  • get_it

    If you need standalone dependency injection without coupling to a specific routing architecture.

Works with

Packages commonly used together with flutter_modular: ones it builds on, ones built on it, and its own family.