dependy 1.0.1 copy "dependy: ^1.0.1" to clipboard
dependy: ^1.0.1 copied to clipboard

Dependy is a lightweight and flexible dependency injection (DI) library for Dart. It simplifies the management of services and their dependencies, making your code more modular, maintainable, and test [...]

example/example.dart

import 'package:dependy/dependy.dart';

/// Check other examples on the source

class CounterService {
  int _count = 0;

  int increment() => ++_count;
}

final module = DependyModule(
  providers: {
    DependyProvider<CounterService>(
      (_) => CounterService(),
    ),
  },
);

void main() async {
  final counterService = module<CounterService>();

  print('Initial Count: ${counterService.increment()}');
  print('After Increment: ${counterService.increment()}');
}
3
likes
140
pub points
0%
popularity

Publisher

unverified uploader

Dependy is a lightweight and flexible dependency injection (DI) library for Dart. It simplifies the management of services and their dependencies, making your code more modular, maintainable, and testable. Dependy also supports hierarchical modules, dependency tracking, and circular dependency detection.

Repository (GitHub)
View/report issues

License

MIT (license)

More

Packages that depend on dependy