getOrNullT method
Retrieves a dependency of the exact runtime type
registered under the
specified groupEntity
.
Note that this method will not return instances of subtypes. For example,
if type
is List<dynamic>
and List<String>
is actually registered,
this method will not return that registered dependency. This limitation
arises from the use of runtime types. If you need to retrieve subtypes,
consider using the standard get
method that employs generics and will
return subtypes.
If the dependency exists, it is returned; otherwise, null
is returned.
If traverse
is set to true
, the search will also include all parent
containers.
The return type is a FutureOr, which means it can either be a Future or a resolved value.
If the dependency is registered as a non-future, the returned value will always be non-future. If it is registered as a future, the returned value will initially be a future. Once that future completes, its resolved value is re-registered as a non-future, allowing future calls to this method to return the resolved value directly.
Implementation
FutureOr<Object>? getOrNullT(
Type type, {
Entity? groupEntity,
bool traverse = true,
}) {
return getOrNullK(
Entity(type),
groupEntity: groupEntity,
traverse: traverse,
);
}