dependy 1.2.0 dependy: ^1.2.0 copied to clipboard
Dependy is a lightweight and flexible dependency injection (DI) library for Dart. It simplifies the management of services and their dependencies.
import 'package:dependy/dependy.dart';
/// Check other examples on the source
class CounterService {
int _count = 0;
int increment() => ++_count;
}
final dependy = DependyModule(
providers: {
DependyProvider<CounterService>(
(_) => CounterService(),
),
},
);
void main() async {
final counterService = await dependy<CounterService>();
print('Initial Count: ${counterService.increment()}');
print('After Increment: ${counterService.increment()}');
}