buildServerAddress function

Uri buildServerAddress(
  1. Uri uri,
  2. bool secure, {
  3. bool webSockets = true,
})

Implementation

Uri buildServerAddress(Uri uri, bool secure, {bool webSockets = true}) {
  if (uri.scheme.isEmpty) {
    uri =
        uri.replace(scheme: (webSockets ? 'ws' : 'http') + (secure ? 's' : ''));
  }
  if (!uri.hasPort) {
    uri = uri.replace(port: kDefaultPort);
  }
  return uri;
}