parseUri function
Valid URLs include 127.0.0.1, 127.0.0.1:22, wss://webssh.
Implementation
Uri parseUri(String uriText) {
Uri uri;
try {
uri = Uri.parse(uriText);
} catch (_) {
uri = Uri.parse('ssh://$uriText');
}
if (!uri.hasScheme) uri = uri = Uri.parse('ssh://$uriText');
if (uri.scheme == 'ssh' && !uri.hasPort) uri = Uri.parse('$uri:22');
return uri;
}