tryGet<T> method

T? tryGet<T>()

Tries to retrieve a registered dependency of type T.

Returns null if the dependency is not found instead of throwing an exception.

Implementation

T? tryGet<T>() {
  final dependency = _registrations[T];
  return dependency?.get() as T?;
}