validateValue method

  1. @override
  2. @mustCallSuper
void validateValue(
  1. List<FlutterPlatform> value
)
inherited

Validates the parsed value, throwing a FormatException if the value is invalid, or a UsageException if the value is invalid for other reasons.

Subclasses may override this method to perform specific validations. If they do, they must also call the super implementation.

Implementation

@override
@mustCallSuper
void validateValue(final List<T> value) {
  super.validateValue(value);

  final allowed = allowedElementValues;
  if (allowed != null) {
    for (final v in value) {
      if (allowed.contains(v) == false) {
        throw UsageException(
            '`$v` is not an allowed value for ${qualifiedString()}', '');
      }
    }
  }
}