Sweetly simple dependency injection.
- Zero dependencies. No third party dependencies, not even the standard library. Pure Dart, works outside of Flutter.
- Implicit registration. Dependencies will automatically register as singletons the moment they're injected. No need to explicitly register them all at the start of your program, consequentially making them lazy loaded.
- Minimal implementation. Fits within ~2.5 kilobytes with a dead simple API and documentation, minification not included.
- No
build_runner
. A simple abstraction that utilizes Dart's type system.
- Factories?.
fuel
does not explicitly provide a method for registering factories. Provide the dependency as is sincefuel
expects you to not tightly couple dependencies and dependents a la dependency injection. - Eager loading? Call the
use
method at the start of your program a la traditional usage of service locators. - Asynchronous injectors?
fuel
will not explicitly provide support for asynchronous injectors. Since injectors infuel
are just functions, futures can be resolved within the injector via the.then
method. - Updates? Likely not. The API will intentionally remain small to do one
thing, and one thing well; more complex requirements are better served by the
get_it
package. It is unlikely bugs will occur with how short & simple the implementation of this package is. - Do I need this? Not necessarily. This package merely provides you with the convenience of having an architectural pattern already implemented for you that you can also implement yourself within a few lines of code.
# For Flutter projects
flutter pub add fuel
# Otherwise
dart pub add fuel
Licensed under the BSD 3 Clause license.