containsSingleton method

  1. @override
bool containsSingleton(
  1. String name
)

Returns true if this registry contains a pod with the given name.

This method provides a lightweight way to check for pod existence without the overhead of retrieving the actual pod object.

name: The name of the pod to check for Returns true if a pod with the given name exists in the registry, false otherwise

Example:

if (registry.containsSingleton('userService')) {
  print('userService is registered');
} else {
  print('userService is not available');
}

Implementation

@override
bool containsSingleton(String name) {
  if (_parent != null && _parent!.getPodFactory().containsSingleton(name)) {
    return true;
  }

  return getPodFactory().containsSingleton(name);
}