validateForPlatform method

void validateForPlatform(
  1. BuildPlatform platform
)

Validates that this format is compatible with the specified platform.

Throws a ValidationException if the format cannot be built for platform.

Implementation

void validateForPlatform(BuildPlatform platform) {
  switch (platform) {
    case BuildPlatform.android:
      if (this == BuildFormat.ipa) {
        throw ValidationException(
          'Format "$this" is not supported on Android. Allowed Android formats: appbundle (aab), apk.',
        );
      }
      break;
    case BuildPlatform.ios:
      if (this != BuildFormat.ipa) {
        throw ValidationException(
          'Format "$this" is not supported on iOS. Allowed iOS format: ipa.',
        );
      }
      break;
    case BuildPlatform.all:
      break;
  }
}