dependy 1.0.1 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 [...]
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()}');
}