Skip to content
modularity_injectableClassesmodularity_injectable

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:
dart
ModularityRoot(
  binderFactory: const GetItBinderFactory(),
  child: const MyApp(),
)
  1. In your module, use ModularityInjectableBridge to wire registrations:
dart
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
BinderGetItGetIt wrapper that falls back to Modularity's Binder chain on resolve.
GetItBinderBinder implementation backed by two separate GetIt instances (private and public scopes), designed for integration with the injectable package.
GetItBinderFactoryBinderFactory that produces GetItBinder instances for the modularity_injectable integration.
ModularityExportOnlyEnvironmentFilter that passes only dependencies annotated with modularityExportEnv (or @Environment(modularityExportEnvName)).
ModularityInjectableBridgeHelper that wires injectable-generated init functions into the Modularity module lifecycle.

Constants

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

Typedefs

TypedefDescription
InjectableInitFnSignature of a generated injectable init function.