connectToHotspot method

  1. @override
Future<void> connectToHotspot(
  1. String ssid,
  2. String psk
)
override

Initiates a connection attempt to a Wi-Fi Direct hotspot using the provided credentials.

  • ssid: The network name (SSID) of the target hotspot.
  • psk: The password (Pre-Shared Key) of the target hotspot. Listen to streamHotspotClientState for connection status updates. Returns a Future that completes when the connection attempt is initiated.

Implementation

@override
Future<void> connectToHotspot(String ssid, String psk) async {
  await methodChannel.invokeMethod(
    'connectToHotspot',
    {'ssid': ssid, 'psk': psk},
  );
}