validateOptionValue method

String? validateOptionValue(
  1. File? value
)
inherited

Returns an error message if the value is invalid, or null if valid.

This method is intended for internal use.

Implementation

String? validateOptionValue(final V? value) {
  if (value == null && mandatory) {
    return '${qualifiedString()} is mandatory';
  }

  if (value != null) {
    try {
      validateValue(value);
    } on FormatException catch (e) {
      return _makeFormatErrorMessage(e);
    } on UsageException catch (e) {
      return _makeErrorMessage(e.message);
    }
  }
  return null;
}