buildServerAddress function

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

Implementation

Uri buildServerAddress(String input, bool secure, {bool webSockets = true}) {
  final splitted = input.split(':');
  return Uri(
    scheme: (webSockets ? 'ws' : 'http') + (secure ? 's' : ''),
    host: splitted[0],
    port: splitted.length <= 1 ? kDefaultPort : int.parse(splitted[1]),
  );
}