GetIt
stackchain: di: get_itHow it works
Section titled “How it works”configureDependencies()is called fromlib/bootstrap.dart- Core services (network, storage, session, logger, …) register in the
coreregion - Per-feature registrations live in the
featuresregion viasync/feature/migrate/rename
For layered architectures (feature_first / clean), each feature registers:
| Registration | Lifetime |
|---|---|
<Feature>RemoteDataSource → impl |
lazy singleton |
<Feature>Repository → impl |
lazy singleton |
Get<Feature> use case |
lazy singleton |
<Feature>Bloc / Cubit / Controller (when applicable) |
factory |
Hand-written registrations should live outside markers so sync cannot wipe them.
// <stackchain:core>// SessionService, DioClient, …// </stackchain:core>
// <stackchain:features>// HomeRemoteDataSource, HomeRepository, GetHome, HomeBloc, …// </stackchain:features>