findOrNull<S> method

S? findOrNull<S>({
  1. String? tag,
})

The findOrNull method will return the instance if it is registered; otherwise, it will return null.

Implementation

S? findOrNull<S>({String? tag}) {
  if (isRegistered<S>(tag: tag)) {
    return find<S>(tag: tag);
  }
  return null;
}