DBusAddress.tcp constructor

DBusAddress.tcp(
  1. String host, {
  2. String? bind,
  3. int? port,
  4. DBusAddressTcpFamily? family,
})

Creates a new D-Bus address connecting to a TCP socket.

Implementation

factory DBusAddress.tcp(String host,
    {String? bind, int? port, DBusAddressTcpFamily? family}) {
  var properties = <String, String>{'host': host};
  if (bind != null) {
    properties['bind'] = bind;
  }
  if (port != null) {
    properties['port'] = '$port';
  }
  if (family != null) {
    properties['family'] = {
      DBusAddressTcpFamily.ipv4: 'ipv4',
      DBusAddressTcpFamily.ipv6: 'ipv6'
    }[family]!;
  }
  return DBusAddress.withTransport('tcp', properties);
}