mobile_nebula/lib/validators/mtuValidator.dart

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

15 lines
306 B
Dart
Raw Normal View History

2020-07-27 20:43:58 +00:00
Function mtuValidator(bool required) {
return (String str) {
if (str == "") {
2020-07-27 20:43:58 +00:00
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;
};
}