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#
- Use GetItBinderFactory when creating your ModularityRoot:
ModularityRoot(
binderFactory: const GetItBinderFactory(),
child: const MyApp(),
)
- 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#
- GetItBinder -- dual-container binder for private/public scopes.
- GetItBinderFactory -- factory producing GetItBinder instances.
- BinderGetIt -- GetIt wrapper with Modularity binder chain fallback.
- ModularityInjectableBridge -- connects injectable init functions.
- ModularityExportOnly -- environment filter for export-only deps.
Classes#
| Class | Description |
|---|---|
| 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#
| Constant | Description |
|---|---|
| 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#
| Typedef | Description |
|---|---|
| InjectableInitFn | Signature of a generated injectable init function. |