Node constructor

Node(
  1. Protocol protocol,
  2. String host, {
  3. int? port,
  4. String path = '',
  5. Client? client,
})

Implementation

Node(
  Protocol protocol,
  String host, {
  int? port,
  String path = '',
  this.client,
}) {
  if (host.isEmpty) {
    throw MissingConfiguration('Ensure that Node.host is not empty');
  }

  if (port == null) {
    switch (protocol) {
      case Protocol.https:
        port = 443;
        break;
      case Protocol.http:
        port = 80;
        break;
    }
  }

  uri = Uri(
    scheme: protocol.value(),
    host: host,
    port: port,
    path: path,
  );
}