force_inject 0.4.0
force_inject: ^0.4.0 copied to clipboard
A zero-dependency DI container for Dart, inspired by .NET Core. This is the Way.
Changelog #
0.4.0 #
β¨ Features
-
Added Modular DI support with
ForceInjectModule
interface -
Modules can encapsulate service + constructor registration
-
addModule()
extension simplifies service setup and keeps code modular -
Added
ServiceScope.overrideService<T>()
andoverrideAllServices()
to support scoped overrides -
Useful for mocking services in tests, previews, and per-screen contexts
π Improvements
-
Enhanced README with examples, getting started, advanced usage, and Flutter instructions
-
Refined internal architecture for future extensibility
π Docs
- Added full examples section and updated all advanced usage sections
- Added links to GitHub example projects
0.3.0 #
β¨ Features
-
Support for named and tagged service resolution:
get<T>(name: ...)
getTagged<T>(tag)
getAll<T>()
to resolve multiple implementations of a type
-
Scoped DI now includes auto-disposal:
- If a service implements
Disposable
, itβs disposed when theServiceScope
is destroyed
- If a service implements
π§° Internals
- Added
Disposable
interface - Extended
ServiceProvider
andServiceScope
to track tagged/named instances - Improved internal resolution logic with
_resolveDescriptor
method
0.2.3 #
- README.md improvements
0.2.2 #
- Introduced support to scoped lifetime
- Introduced example for flutter with scoped lifetime.
- README.md improvements
0.1.0 #
- Initial release
- Supports singleton and transient lifetimes
- Manual constructor registration
- Clean C#-style architecture
- Designed for use in backend, CLI, and Flutter