modularity_injectable
LogoModularity

modularity_injectable#

Integration layer between Modularity and the injectable code-generation package.

Provides a GetItBinder that manages two separate GetIt containers (private and public), a BinderGetIt wrapper that resolves through the Modularity binder chain, and a ModularityInjectableBridge that connects injectable-generated init functions to the Modularity lifecycle.

Setup#

  1. Use GetItBinderFactory when creating your ModularityRoot:
ModularityRoot(
  binderFactory: const GetItBinderFactory(),
  child: const MyApp(),
)
  1. In your module, use ModularityInjectableBridge to wire registrations:
class AuthModule extends Module {
  @override
  void binds(Binder binder) {
    ModularityInjectableBridge.configureInternal(binder, configureDependencies);
  }

  @override
  void exports(Binder binder) {
    ModularityInjectableBridge.configureExports(binder, configureDependencies);
  }
}

Key Classes#

Classes#

ClassDescription
BinderGetIt GetIt wrapper that falls back to Modularity's Binder chain on resolve.
GetItBinder Binder implementation backed by two separate GetIt instances (private and public scopes), designed for integration with the injectable package.
GetItBinderFactory BinderFactory that produces GetItBinder instances for the modularity_injectable integration.
ModularityExportOnly EnvironmentFilter that passes only dependencies annotated with modularityExportEnv (or @Environment(modularityExportEnvName) ).
ModularityInjectableBridge Helper that wires injectable-generated init functions into the Modularity module lifecycle.

Constants#

ConstantDescription
modularityExportEnv Annotation constant for teams that prefer @modularityExportEnv syntax over @Environment(modularityExportEnvName) .
modularityExportEnvName Name of the environment flag that marks dependencies as exportable from a module's public scope.

Typedefs#

TypedefDescription
InjectableInitFn Signature of a generated injectable init function.