dependencies_container 1.1.4 copy "dependencies_container: ^1.1.4" to clipboard
dependencies_container: ^1.1.4 copied to clipboard

discontinuedreplaced by: service_waiter
SDKDart

Simple service locator with existing instance by default

Dependencies container written on pure dart

Documentation: in progress...

void main() {
  final container = DependenciesContainer(
      dependencies: {
        int: () => 5,
        String: () => '5',
      },
      lazySingletons: {String}
  );
  final str = container.dependency<String>(); // once created and returned
  final str2 = container.dependency<String>(); // already created and returned from cache
  // str and str2 are same instances
  container.clearSingleton<String>(); // removing from cache, next time call will return new one
  // not declared in singleton scope will return new one instance every time
  final integer = container.dependency<int>(); // once created
  final integer2 = container.dependency<int>(); // once created
  //integer and integer2 are different instances
}

0
likes
110
pub points
0%
popularity

Publisher

verified publisherrenesanse.net

Simple service locator with existing instance by default

Documentation

API reference

License

MIT (LICENSE)

More

Packages that depend on dependencies_container