# doGetObject method

1. @protected

Future<Object> doGetObject(

1. Object instance,
2. Class? type,
3. String name,
4. String transformed,
5. PodDefinition? definition,

)

Internal method to handle PodProvider unwrapping and instance retrieval.

This method processes the retrieved pod instance, handling PodProvider unwrapping and ensuring the correct instance is returned based on the request type (provider pod vs produced pod).

`instance` the pod instance retrieved from cache or creation `type` the expected type of the pod `name` the original pod name `transformed` the transformed pod name `definition` the pod definition (optional) Returns the final pod instance to return

Throws PodIsNotAProviderException if a provider pod is expected but not found

## Implementation

    @protected
    Future<Object> doGetObject(Object instance, Class? type, String name, String transformed, PodDefinition? definition) async {
      Object object;
      if (instance is Future) {
        object = await instance;
      } else {
        object = instance;
      }

      // If name starts with &, return the provider pod itself
      if (PodUtils.isFactoryDereference(name)) {
        if (object is NullablePod) {
    				throw PodCreationException.withResource(
    					definition?.description,
    					transformed,
    					"Failed to create singleton pod '$transformed'. The pod is null."
    				);
    			} else if (object is! PodProvider) {
          throw PodIsNotAProviderException(transformed, type ?? object.getClass());
        } else if (definition != null) {
    				definition.isPodProvider = true;
    			}

        return object;
      }

      // If not a provider pod, return as-is
      if (object is! PodProvider) {
        return object;
      } else {
        // Handle PodProvider
        if (definition != null) {
    				definition.isPodProvider = true;
    			}

        Object? po;
        if (definition == null) {
          final nullable = await getNullableProviderObject(transformed);
          if (nullable != null) {
            po = nullable.getValue();
          }
        }

        if (po == null) {
          if (definition == null && await containsDefinition(transformed)) {
            definition = await getLocalMergedPodDefinition(transformed);
          }

          if (definition != null) {
            definition.isPodProvider = true;
          }

          bool synthetic = definition != null && definition.design.isInfrastructure;
          final provider = await getProviderObject(object, type, transformed, !synthetic);
          po = provider.getValue();
        }

        return po;
      }
    }