petrol 2.0.0 petrol: ^2.0.0 copied to clipboard
A minimal, simple, and small dependency injection library for Dart and Flutter apps.
Petrol #
Minimal dependency injection library.
Features #
- 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 kilobytes with a dead simple API and documentation, minification not included.
- No
build_runner
. A simple abstraction that utilizes Dart's type system.
Q&A #
- Factories?.
petrol
does not explicitly provide a method for registering factories. Provide the dependency as is. - Asynchronous injectors?
petrol
will not explicitly provide support for asynchronous injectors. - Eager loading? Call the
use
method at the start of your program a la traditional usage of service locators.
Installation #
# For Flutter projects
flutter pub add petrol
# Otherwise
dart pub add petrol
Notice #
Licensed under the BSD 3 Clause license.