dependy 1.2.0 copy "dependy: ^1.2.0" to clipboard
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.

example/example.dart

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()}');
}
7
likes
160
points
43
downloads

Publisher

verified publisherdependy.dev

Weekly Downloads

Dependy is a lightweight and flexible dependency injection (DI) library for Dart. It simplifies the management of services and their dependencies.

Repository (GitHub)

Documentation

API reference

License

MIT (license)

More

Packages that depend on dependy