dependon 1.2.0 copy "dependon: ^1.2.0" to clipboard
dependon: ^1.2.0 copied to clipboard

Simple, light-weight and extremely legible package for dependency injection management.

example/main.dart

import 'package:dependon/dependon.dart';

import 'controller/user_controller.dart';
import 'data/repository/user_repository.dart';
import 'data/repository/user_repository_impl.dart';
import 'usecase/user_use_case.dart';

void main() {
  final Dependon di = Dependon.instance;
  di.enableLogging(true);

  di.factory(() => UserUseCase(get()));
  di.singleton<UserRepository>(() => UserRepositoryImpl());

  // non-lazy singletons should always be the last to be declared
  di.singleton(() => UserController(get()), lazy: false);

  final UserController controller = get();
  controller.showUsers();
}
2
likes
160
points
25
downloads

Publisher

verified publisherniun.dev

Weekly Downloads

Simple, light-weight and extremely legible package for dependency injection management.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter

More

Packages that depend on dependon