find<T> method

T find<T>()

Get registered dependency in DI container Specify requested dependency type via T If the requested dependency is not found, Pulse will throw Injection Error

Implementation

T find<T>() {
  final dynamic service = _services[T];

  /// throw dependency injection error if service[T] has not been injected yet
  assert(service != null, PulseXErrors.injectionError(T));
  if (service is LazySingleton<T>) {
    return service.instance;
  }
  return service as T;
}