findOrNull<S> method

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

Finds and returns the registered instance of type S if it exists, otherwise returns null.

  • tag Optional tag to identify the instance.

Implementation

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