# createPod<T> method

1. @override

Future<T> createPod<T>(

1. T instance,
2. Class type

)
override

Creates and registers a pod from an existing instance.

This method is useful when you have an existing instance that you want to register as a pod in the factory for dependency injection.

## Usage Example:

    final existingService = MyService();
    await factory.createPod(existingService, Class<MyService>());

    // Now other pods can autowire MyService
    final consumer = await factory.get<ServiceConsumer>();

@param instance The existing instance to register as a pod @param type The class type of the pod @return A Future that completes with the pod instance

## Implementation

    @override
    Future<T> createPod<T>(T instance, Class type) async {
      if(!type.isInstance(instance)) {
        throw PodCreationException("Instance type does not match pod class type");
      }

      final definition = RootPodDefinition(type: type)
        ..scope = ScopeDesign.type(ScopeType.PROTOTYPE.name);

      return await doCreate(type.getName(), definition, null) as T;
    }