# populate method

1. @protected

Future<void> populate(

1. String podName,
2. RootPodDefinition root,
3. PodHolder ph

)

Populates a pod instance with property values and dependencies.

This method handles autowiring by name or type, applies property values, and performs dependency checking.

@param podName The name of the pod @param root The pod definition @param ph The pod holder containing instance and class

## Implementation

    @protected
    Future<void> populate(String podName, RootPodDefinition root, PodHolder ph) async {
      if (ph.$2.isRecord()) {
    			if (root.hasPropertyValues()) {
    				throw PodCreationException.withResource(
            root.description,
            podName,
            "Cannot apply property values to a record"
          );
    			} else {
    				// Skip property population phase for records since they are immutable.
    				return;
    			}
    		}

      // Give any InstantiationAwarePodPostProcessors the opportunity to modify the
    		// state of the pod before properties are set. This can be used, for example,
    		// to support styles of field injection.
      await applyAfterInstantiationProcessing(ph.$1, podName, ph.$2);

      MutablePropertyValues pvs = root.propertyValues;
      int autowire = root.autowireCandidate.autowireMode.value;
    		if (autowire == AutowireMode.BY_NAME.value) {
        await autowireByName(podName, root, ph, pvs);
    		} else if (autowire == AutowireMode.BY_TYPE.value) {
        await autowireByType(podName, root, ph, pvs);
    		}

      if (hasInstantiationPodPostProcessors()) {
        getPodProcessorCacheManager().instantiation.process((iap) async {
    				PropertyValues? usage = await iap.processPropertyValues(pvs, ph.$1, ph.$2, podName);
    				if (usage == null) {
    					return;
    				}

    				pvs = MutablePropertyValues.from(usage);
        });
    		}

      bool needsDepCheck = root.dependencyCheck != DependencyCheck.NONE;
    		if (needsDepCheck) {
        checkDependencies(podName, root, ph, pvs);
      }

    		if (pvs.isNotEmpty) {
    			applyPropertyValues(podName, root, ph, pvs);
    		}
    }