File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change
1
+ import 'package:flutter/material.dart' ;
2
+ import '../form_builder_validators.dart' ;
3
+
4
+ extension FormFieldValidatorExtensions <T > on FormFieldValidator <T > {
5
+ /// Combines the current validator with another validator using logical AND.
6
+ FormFieldValidator <T > and (FormFieldValidator <T > other) {
7
+ return FormBuilderValidators .compose ([this , other]);
8
+ }
9
+
10
+ /// Combines the current validator with another validator using logical OR.
11
+ FormFieldValidator <T > or (FormFieldValidator <T > other) {
12
+ return FormBuilderValidators .or ([this , other]);
13
+ }
14
+
15
+ /// Adds a condition to apply the validator only if the condition is met.
16
+ FormFieldValidator <T > when (bool Function (T value) condition) {
17
+ return FormBuilderValidators .conditional (condition, this );
18
+ }
19
+ }
You can’t perform that action at this time.
0 commit comments