# isSingleton method

1. @override

Future<bool> isSingleton(

1. String name

)
override

Checks if the specified pod is configured as a singleton.

Singleton pods are instantiated only once and the same instance is returned for all subsequent requests.

## Usage Example:

    if (await factory.isSingleton('appConfig')) {
      print('AppConfig is a singleton - all components share the same instance');
    }

@param podName The name of the pod to check @return A Future that completes with true if the pod is a singleton

## Implementation

    @override
    Future<bool> isSingleton(String name) async {
      final transformed = transformedPodName(name);

      final singleton = await super.getSingleton(transformed, allowEarlyReference: false);
      if (singleton != null) {
        if (singleton is PodProvider) {
    				return (PodUtils.isFactoryDereference(name) || singleton.isSingleton());
    			} else {
    				return !PodUtils.isFactoryDereference(name);
    			}
      }

      // No singleton instance found -> check pod definition.
    		final parent = getParentFactory();
    		if(parent != null && !containsDefinition(transformed)) {
    			// No pod definition found in this provider -> delegate to parent.
    			return parent.isSingleton(PodUtils.originalName(name));
    		}

      final merged = getLocalMergedPodDefinition(transformed);

      // In case of PodProvider, return singleton status of created object if not a dereference.
    		if (merged.scope.isSingleton) {
    			if (await isPodProvider(transformed, merged)) {
    				if (PodUtils.isFactoryDereference(name)) {
    					return true;
    				}

          final res = await getPod(podProviderName(transformed));
          if (res is PodProvider) {
            return res.isSingleton();
          }

          return false;
    			} else {
    				return !PodUtils.isFactoryDereference(name);
    			}
    		} else {
    			return false;
    		}
    }