# isPrototype method

1. @override

Future<bool> isPrototype(

1. String name

)
override

Checks if the specified pod is configured as a prototype.

Prototype pods create a new instance every time they are requested.

## Usage Example:

    if (await factory.isPrototype('requestContext')) {
      print('RequestContext is a prototype - new instance for each request');
    }

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

## Implementation

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

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

    		final merged = getLocalMergedPodDefinition(transformed);
    		if (merged.scope.isPrototype) {
    			// In case of PodProvider, return singleton status of created object if not a dereference.
    			return (!PodUtils.isFactoryDereference(name) || await isPodProvider(transformed, merged));
    		}

    		// Singleton or scoped - not a prototype.
    		// However, PodProvider may still produce a prototype object...
    		if (PodUtils.isFactoryDereference(name)) {
    			return false;
    		}

    		if (await isPodProvider(transformed, merged)) {
    			final pp = await getPod(podProviderName(transformed));
        if (pp is PodProvider) {
          return pp.isPrototype() || !pp.isSingleton();
        }

    			return false;
    		} else {
    			return false;
    		}
    }