added validator for whole numbers
This commit is contained in:
@@ -7,6 +7,15 @@ String? timeValidator(String? value) {
|
|||||||
return 'Not a valid time format';
|
return 'Not a valid time format';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String? wholeNumberValidator(String? value) {
|
||||||
|
if (value == null || value.isEmpty) return null;
|
||||||
|
|
||||||
|
if (RegExp(r'^[0-9]*$').hasMatch(value)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return 'Not a valid number';
|
||||||
|
}
|
||||||
|
|
||||||
String? dateTimeValidator(String? value) {
|
String? dateTimeValidator(String? value) {
|
||||||
if (value == null || value.isEmpty) return null;
|
if (value == null || value.isEmpty) return null;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user