utopia_di 0.2.1 copy "utopia_di: ^0.2.1" to clipboard
utopia_di: ^0.2.1 copied to clipboard

Light & Fast Dart Dependency Injection library. Easy to use and powerful for all kinds of needs, with no external dependencies.

example/utopia_di_example.dart

import 'package:utopia_di/utopia_di.dart';

void main() {
  final di = DI.i;
  di.set('resource1', () => 'this is resource 1');
  di.set('number1', () => 10);
  di.set(
    'dependentResource',
    (String resource1, int number1) => '$resource1 and $number1',
    injections: ['resource1', 'number1'],
  );

  print(di.get('resource1'));
  print(di.get('number1'));
  print(di.get('dependentResource'));
}
1
likes
160
pub points
2%
popularity

Publisher

verified publisherappwriters.dev

Light & Fast Dart Dependency Injection library. Easy to use and powerful for all kinds of needs, with no external dependencies.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (LICENSE)

More

Packages that depend on utopia_di