Host.create constructor

Host.create({
  1. required String url,
  2. String scheme = 'https',
  3. CallType? callType,
})

Implementation

factory Host.create(
    {required String url, String scheme = 'https', CallType? callType}) {
  if (url.contains(':')) {
    final parts = url.split(':');
    return Host(
        url: parts[0],
        port: int.parse(parts[1]),
        scheme: scheme,
        callType: callType);
  }

  return Host(url: url, scheme: scheme, callType: callType);
}