multiple method
use to apply multiple validations
TextFormField(
autovalidateMode: AutovalidateMode.onUserInteraction,
controller: editController,
validator: (value) => Mask.validations.multiple(
validations: [
Mask.validations.generic(value, min: 4, error: 'min 4'),
Mask.validations.email(value, error: 'email inválido'),
],
),
),
Implementation
String? multiple({
required List<String?> validations,
}) {
for (var validation in validations) {
if (validation != null) return validation;
}
return null;
}