# autowire method

1. @override

Future<Object> autowire(

1. Class podClass,
2. int autowireMode,
3. bool checkDependency

)
override

Creates and autowires a new pod instance from a class.

This method combines instance creation and dependency injection in a single operation.

## Usage Example:

    final pod = await factory.autowire(
      Class<ComplexService>(),
      AutowireMode.byType,
      true,
    );

@param podClass The class of the pod to create and autowire @param autowireMode The autowiring mode to use @param checkDependency Whether to check dependency validity @return A Future that completes with the autowired pod instance

## Implementation

    @override
    Future<Object> autowire(Class podClass, int autowireMode, bool checkDependency) async {
      RootPodDefinition root = RootPodDefinition(type: podClass)
        ..scope = ScopeDesign.type(ScopeType.PROTOTYPE.name)
        ..autowireCandidate = AutowireCandidateDescriptor(autowireCandidate: true, autowireMode: AutowireMode.fromValue(autowireMode));

      if (autowireMode == AutowireMode.BY_TYPE) {
        return await instantiateUsingConstructor(podClass.getName(), root, null, null);
      } else {
        Object instance = await instantiateUsingConstructor(podClass.getName(), root, null, null);
        await populate(podClass.getName(), root, (instance, podClass));

        return instance;
      }
    }