injectzone

Last updated:

0 purchases

injectzone Image
injectzone Images
Add to Cart

Description:

injectzone

Injeczone is a simple and lightweight dependency injection library for Dart that allows you to override dependencies via
your type.
Internally Injectzone uses zones and the zoneValues attribute to create or return injected dependencies.
Usage #
To use this package, add injectzone as a dependency in your pubspec.yaml file.

Inject T dependency from builder function:


final deviceInfo = Injectzone().inject(() => DeviceInfoPlugin());

/// Note: [DeviceInfoPlugin] is a third party dependency
copied to clipboard

Override T dependency with mock by ValueInjector during callback execution:

await Injectzone().withInjected([
ValueInjector.inject<DeviceInfoPlugin>(mockDeviceInfoPlugin),
], () {
///... my test code
});
copied to clipboard
Features and bugs #
Please file feature requests and bugs at the issue tracker.

License:

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product:

Customer Reviews

There are no reviews.