fileExtension static method

FormFieldValidator<String> fileExtension(
  1. List<String> allowedExtensions, {
  2. String? errorText,
  3. bool checkNullOrEmpty = true,
})

FormFieldValidator that requires the field's value to a valid file extension.

Parameters:

  • allowedExtensions The list of allowed file extensions.
  • errorText The error message when the file extension is invalid.
  • checkNullOrEmpty Whether to check for null or empty values.

Implementation

static FormFieldValidator<String> fileExtension(
  List<String> allowedExtensions, {
  String? errorText,
  bool checkNullOrEmpty = true,
}) => FileExtensionValidator(
  allowedExtensions,
  errorText: errorText,
  checkNullOrEmpty: checkNullOrEmpty,
).validate;