getUrl function
Implementation
Uri getUrl(Object address, int port, bool isSecure) {
String host;
if (address is InternetAddress) {
if (address.isLoopback) {
host = 'localhost';
} else if (address.type == InternetAddressType.IPv6) {
host = '[${address.address}]';
} else {
host = address.address;
}
} else {
host = address as String;
}
return Uri(scheme: isSecure ? 'https' : 'http', host: host, port: port);
}