File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -794,6 +794,24 @@ class FormBuilderValidators {
794
794
checkNullOrEmpty: checkNullOrEmpty,
795
795
).validate;
796
796
797
+ /// [FormFieldValidator] that requires the field's value to be a valid MIME type.
798
+ /// The MIME type should be in the format `type/subtype` .
799
+ ///
800
+ /// ## Parameters:
801
+ /// - [regex] The regex pattern to match.
802
+ /// - [errorText] The error message when the file name is invalid.
803
+ /// - [checkNullOrEmpty] Whether to check for null or empty values.
804
+ static FormFieldValidator <String > mimeType ({
805
+ RegExp ? regex,
806
+ String ? errorText,
807
+ bool checkNullOrEmpty = true ,
808
+ }) =>
809
+ MimeTypeValidator (
810
+ regex: regex,
811
+ errorText: errorText,
812
+ checkNullOrEmpty: checkNullOrEmpty,
813
+ ).validate;
814
+
797
815
/// [FormFieldValidator] that applies another validator conditionally.
798
816
///
799
817
/// ## Parameters:
You can’t perform that action at this time.
0 commit comments