iod

Last updated:

0 purchases

iod Image
iod Images
Add to Cart

Description:

iod

IoD - Dependency Injection #

The objective of this package is provide a simple way to do the Dependency Injection.
How to use #
Register #
The first you need register an instance of the object, for example:
void main() {
IoD.register<IPersistence>(Persistence());
runApp(const MyApp());
}
copied to clipboard
To clarify, the IPersistence is just example of an interface, like this bellow:
abstract class IPersistence {
String read();
void write(String text);
}
copied to clipboard
The Class Persistence is a implementation of a interface IPersistence.
Read Instance #
To get the instance you need to use the method read, like that:
final persistence = IoD.read<IPersistence>();
copied to clipboard

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.