# createInstance method

1. @protected

Future<PodHolder> createInstance(

1. String podName,
2. RootPodDefinition root,
3. List<ArgumentValue>? args

)

Creates a pod instance using the appropriate strategy (factory method, constructor, or default instantiation).

@param podName The name of the pod @param root The pod definition @param args Optional arguments for creation @return A PodHolder containing the instance and its class

## Implementation

    @protected
    Future<PodHolder> createInstance(String podName, RootPodDefinition root, List<ArgumentValue>? args) async {
      Class podClass = root.type;

      // Obtain from provided instance
      if (root.instance != null) {
        Object instance = await instantiateFromSupplier(root.instance!);
        return (instance, instance.getClass());
      }

      // Obtain from factory method
      if (root.factoryMethod.methodName.isNotEmpty) {
        final instance = await instantiateUsingFactoryMethod(podName, root, args);
        return (instance, instance.getClass());
      }

      // Obtain from constructor arguments
      final cs = await determineConstructorsFromPodProcessors(podClass, podName);
      final instance = await instantiateUsingConstructor(podName, root, cs, args);
      return (instance, instance.getClass());
    }