port property

int? port
override

The value of the port part of the hostHeader header, if any.

Implementation

int? get port {
  final host = value('host');
  if (host == null) return null;

  final uri = Uri.tryParse('http://$host');
  if (uri == null) return null;

  return uri.port;
}
void port=(int? v)
override

The value of the port part of the hostHeader header, if any.

Implementation

set port(int? v) {
  if (v != null) {
    set('host', '$host:$v');
  } else {
    final host = value('host');
    if (host != null) {
      final uri = Uri.tryParse('http://$host');
      if (uri != null) {
        set('host', uri.host);
      }
    }
  }
}