dardi 0.1.1 copy "dardi: ^0.1.1" to clipboard
dardi: ^0.1.1 copied to clipboard

Simple DI library for flutter and pure dart projects.

Dardi #

Lightweight dependency Injection library based on service locator pattern with a terse interface.

main() async {
  //1) Register the necessary dependencies.
  Dardi.addSingleton(() => UserNetworkProvider());
  Dardi.addSingleton(() => UserMemoryProvider());

  //2) Register and get the necessary dependencies.
  Dardi.addDependency(() => UserRepository(
        Dardi.getDependency(),
        Dardi.getDependency(),
      ));

  var view = UserTerminalView();
  view.show();
}

class UserTerminalView {
  //3) And get the necessary dependencies.
  final UserRepository _repository = Dardi.getDependency();

  void show() async {
      ***
  }
}

Installation #

Add on pubspec.yml:

  dependencies:
    dardi: ^0.1.0

Getting Started #

This project is a starting point for a Dart package, a library module containing code that can be shared easily across multiple Flutter or Dart projects.

For help getting started with Flutter, view our online documentation, which offers tutorials, samples, guidance on mobile development, and a full API reference.

0
likes
20
pub points
0%
popularity

Publisher

unverified uploader

Simple DI library for flutter and pure dart projects.

Homepage
Repository (GitHub)
View/report issues

License

MIT (LICENSE)

More

Packages that depend on dardi