MethodChannelFlutterP2pConnection class

An implementation of FlutterP2pConnectionPlatform that uses method channels for communication with the native platform code (Android/iOS).

Inheritance

Properties

bleConnectionStateEventChannel → EventChannel
The event channel for receiving BleConnectionState updates.
final
bleReceivedDataEventChannel → EventChannel
The event channel for receiving BleReceivedData from connected BLE devices.
final
bleScanResultEventChannel → EventChannel
The event channel for receiving lists of BleDiscoveredDevice during scans.
final
clientStateEventChannel → EventChannel
The event channel for receiving HotspotClientState updates.
final
hashCode → int
The hash code for this object.
no setterinherited
hotspotStateEventChannel → EventChannel
The event channel for receiving HotspotHostState updates.
final
methodChannel → MethodChannel
The method channel used to invoke native methods.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

askP2pPermissions() → Future<void>
Requests necessary Wi-Fi P2P (Wi-Fi Direct) permissions from the user.
override
checkBluetoothEnabled() → Future<bool>
Checks if Bluetooth is enabled on the device.
override
checkLocationEnabled() → Future<bool>
Checks if location services are enabled on the device.
override
checkP2pPermissions() → Future<bool>
Checks if the necessary Wi-Fi P2P (Wi-Fi Direct) permissions are granted.
override
checkWifiEnabled() → Future<bool>
Checks if Wi-Fi is enabled on the device.
override
connectBleDevice(String deviceAddress) → Future<void>
Initiates a connection attempt to a specific BLE device.
override
connectToHotspot(String ssid, String psk) → Future<void>
Initiates a connection attempt to a Wi-Fi Direct hotspot using the provided credentials.
override
createHotspot() → Future<void>
Initiates the creation of a Wi-Fi Direct group (hotspot) on the native side.
override
disconnectBleDevice(String deviceAddress) → Future<void>
Disconnects from a connected BLE device.
override
disconnectFromHotspot() → Future<void>
Disconnects from the currently connected Wi-Fi Direct hotspot.
override
dispose() → Future<void>
Disposes native P2P and BLE resources and cleans up connections.
override
enableBluetoothServices() → Future<void>
Attempts to open the device's Bluetooth settings screen for the user to enable Bluetooth.
override
enableLocationServices() → Future<void>
Attempts to open the device's location settings screen for the user to enable location services.
override
enableWifiServices() → Future<void>
Attempts to open the device's Wi-Fi settings screen for the user to enable Wi-Fi.
override
getPlatformModel() → Future<String>
Fetches the native device model identifier.
override
getPlatformVersion() → Future<String>
Fetches the native platform version string.
override
initialize({String? serviceUuid, bool? bondingRequired, bool? encryptionRequired}) → Future<void>
Initializes native P2P and BLE resources.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
removeHotspot() → Future<void>
Removes the currently active Wi-Fi Direct group (hotspot) on the native side.
override
startBleAdvertising(String ssid, String psk) → Future<void>
Starts BLE advertising with the provided Wi-Fi hotspot credentials.
override
startBleScan() → Future<void>
Starts scanning for nearby BLE devices.
override
stopBleAdvertising() → Future<void>
Stops ongoing BLE advertising.
override
stopBleScan() → Future<void>
Stops the ongoing BLE scan.
override
streamBleConnectionState() → Stream<BleConnectionState>
Provides a broadcast stream of BleConnectionState updates.
override
streamBleReceivedData() → Stream<BleReceivedData>
Provides a broadcast stream of BleReceivedData from connected BLE devices.
override
streamBleScanResult() → Stream<List<BleDiscoveredDevice>>
Provides a broadcast stream emitting lists of BleDiscoveredDevice during a BLE scan.
override
streamHotspotClientState() → Stream<HotspotClientState>
Provides a broadcast stream of HotspotClientState updates.
override
streamHotspotInfo() → Stream<HotspotHostState>
Provides a broadcast stream of HotspotHostState updates.
override
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited