setDesktopHost method

void setDesktopHost(
  1. String? host
)

Uses host (192.168.1.20 or 192.168.1.20:9751) as the Wi-Fi address instead of the build's, and tries it at once; null goes back to the build's address. A link through the old Wi-Fi address is closed; the USB link (adb reverse, usbmux) stays.

Implementation

void setDesktopHost(String? host) {
  if (_disposed) return;
  final value = host == null || host.trim().isEmpty ? null : host.trim();
  if (value == _panelHost) {
    // Same address again (the panel's Connect): try it now.
    if (!_connection.connected) retryConnectNow();
    return;
  }
  _panelHost = value;
  _endpointGeneration++;
  _attempts = const <ConnectAttempt>[];
  _failedRounds = 0;
  _trying = !_connection.connected || _lanEndpoint() != null;
  try {
    _transport.setEndpoints(_endpoints());
  } catch (_) {}
  _notifyReport();
}