3
0
Fork 0
trifid_mobile/lib/validators/mtuValidator.dart

15 lines
321 B
Dart
Raw Permalink Normal View History

2020-07-27 20:43:58 +00:00
Function mtuValidator(bool required) {
return (String str) {
if (str == null || str == "") {
return required ? 'Please fill out this field' : null;
}
var mtu = int.tryParse(str);
if (mtu == null || mtu < 0 || mtu > 65535) {
return 'Please enter a valid mtu';
}
return null;
};
}