A modular, zero-runtime-dependency Dependency Injection (DI) system for Dart and Flutter — inspired by .NET Core, and built for clean architecture lovers.
This is the Way.
| Package | Description |
|---|---|
force_inject |
Core DI container with singleton, transient, and scoped lifetimes. Zero dependencies, pure Dart. |
force_inject_flutter |
Flutter integration helpers like ForceScopeWidget, ForceViewModelBuilder<T>, and more. |
Explore real-world usage of ForceInject in Dart and Flutter:
-
🧱
minimal_dart_di
A minimal Dart CLI app using singleton and transient services. -
📱
minimal_flutter_di
A Flutter app using scoped DI and a ViewModel withValueNotifier. -
📱
scoped_widget_flutter_di
A Flutter app usingForceScopeWidgetandForceViewModelBuilderDI and a ViewModel.
To run Flutter examples, remember to generate platform folders first:
cd example/minimal_flutter_di flutter create . flutter pub get flutter run
- Zero runtime dependencies in core
- No mirrors or code generation
- Explicit constructor-based injection
- Lifecycle-aware DI (singleton, transient, scoped)
- Clean, modular architecture for Dart & Flutter apps
- Flutter integrations that stay optional and unopinionated
Created by @diegomgarcia 🇨🇦
This project is open to contributions — especially companion packages like:
forceinject_riverpodforceinject_blocforceinject_codegen
Support me (@diegomgarcia) with Patreon
Or make a donation buying me a coffee:
MIT License — Free to use, modify, and extend.
May the DI be with you. ⚔️

