isPort function
Implementation
bool isPort(Object? input) {
num? _port;
if (input is String) {
_port = num.tryParse(input);
} else if (input is num) {
_port = input;
}
if (_port != null && _port.toInt() != _port) {
return false;
}
return _port != null && 0 <= _port && _port <= 65535;
}