modularity_flutter 0.1.0 copy "modularity_flutter: ^0.1.0" to clipboard
modularity_flutter: ^0.1.0 copied to clipboard

Flutter integration for Modularity framework. Provides widgets and utilities for module-based Flutter apps.

modularity_flutter #

Flutter integration for the Modularity framework.

Features #

  • ModularityRoot: InheritedWidget that holds the DI container factory and module registry.
  • ModuleScope: Scopes dependencies to a specific part of the widget tree.
  • ModuleProvider: Provides access to dependencies in the widget tree.
  • RouteObserver: Automatically handles module lifecycle based on navigation.

Usage #

Wrap your application in ModularityRoot:

void main() {
  runApp(
    ModularityRoot(
      child: MyApp(),
    ),
  );
}

Use ModuleScope to define a module for a subtree:

class FeaturePage extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return ModuleScope(
      module: FeatureModule(),
      child: FeatureView(),
    );
  }
}

Advanced ModuleScope options #

  • retentionPolicy / retentionKey let you opt into KeepAlive or custom retention strategies without wiring your own navigator hooks.
  • overrideScope allows you to pass a ModuleOverrideScope tree that only affects the current module and its imports (useful for temporary test overrides or dynamic feature flags).
1
likes
160
points
258
downloads

Publisher

unverified uploader

Weekly Downloads

Flutter integration for Modularity framework. Provides widgets and utilities for module-based Flutter apps.

Repository (GitHub)
View/report issues

Topics

#dependency-injection #di #flutter #modules

Documentation

API reference

License

MIT (license)

Dependencies

flutter, modularity_contracts, modularity_core

More

Packages that depend on modularity_flutter