# destroyScopedPod method

1. @override

void destroyScopedPod(

1. String name

)
override

Destroys all pods in the specified scope.

This method destroys pods that belong to a specific scope, such as all request-scoped pods when a request completes.

## Usage Example:

    // When request completes
    factory.destroyScopedPod('request');

@param podName The name of the scope to destroy pods for

## Implementation

    @override
    void destroyScopedPod(String name) {
      RootPodDefinition root = getLocalMergedPodDefinition(name);
    		if (root.scope.isSingleton || root.scope.isPrototype) {
    			throw new IllegalArgumentException("Pod name '$name' does not correspond to an object in a mutable scope");
    		}

    		String scopeName = root.scope.type;
    		PodScope? scope = _scopes.get(scopeName);
    		if (scope == null) {
    			throw new IllegalStateException("No Scope SPI registered for scope name '$scopeName'");
    		}

    		Object? pod = scope.remove(name);
    		if (pod != null) {
    			_destroy(name, pod, root);
    		}
    }