validateRequiredProps method

void validateRequiredProps(
  1. Map appliedProps
)

Validates that props with the @requiredProp annotation are present.

Implementation

void validateRequiredProps(Map appliedProps) {
  consumedProps?.forEach((consumedProps) {
    consumedProps.props.forEach((prop) {
      if (!prop.isRequired) return;
      // Skip late prop validation here because it will be handled in .build() / .call().
      if (prop.isLate) return;
      if (prop.isNullable && appliedProps.containsKey(prop.key)) return;
      if (!prop.isNullable && appliedProps[prop.key] != null) return;

      throw PropError.required(prop.key, prop.errorMessage);
    });
  });
}