Usage Example
enum EmailError {
empty,
not;
String toString() {
switch (this) {
case empty:
return 'emailEmpty';
case not:
return 'invalidFormatEmail';
default:
return 'invalidFormatEmail';
}
}
}
class EmailField extends FFormField<String, EmailError> {
EmailField({required String value}) : super(value);
EmailError? validator(value) {
if (value.isEmpty) return EmailError.empty;
return null;
}
}