Dependency manager like dagger from android. This package can also create an instance of a class from a reference to the constructor and dependency area


Code from example/

Create abstract class with annotation @Modules({{you module list}}) for dependency call

    @Modules([CacheModule, DbModule, NetworkModule])
    abstract class Dm {

      static Future<Dm> init() {
        return DmImpl().init();

      DB db();

      CommonConsumer commonConsumer ();

      MarkInjectConsumer markInjectConsumer();

      WithParameterConsumer withParameterConsumer(String name);

The @Modules annotation contains classes with @provide methods tagged that will be available for calling in other modules and consumers.

    class CacheModule {
      Cache cacheModule(DB db, Network<String> network) => Cache(db, network);

This function may contain parameters with types that will be taken from other modules

Dependency can get from module or can creating from first or marked @inject constructor in returned class like this

    class MarkInjectConsumer {
      DB db;
      Cache cache;


      MarkInjectConsumer.cached(this.db, this.cache);