iod 0.0.3 copy "iod: ^0.0.3" to clipboard
iod: ^0.0.3 copied to clipboard

The objective of this package is provide a simple way to do the Dependency Injection.

IoD - Dependency Injection #

codecov

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());
  }

To clarify, the IPersistence is just example of an interface, like this bellow:

  abstract class IPersistence {
    String read();
    void write(String text);
  }

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>();
1
likes
150
pub points
31%
popularity

Publisher

unverified uploader

The objective of this package is provide a simple way to do the Dependency Injection.

Homepage

Documentation

API reference

License

MIT (license)

Dependencies

flutter

More

Packages that depend on iod