BluetoothDevice class
Implemented types
Available extensions
Methods
cancelWhenDisconnected (StreamSubscription subscription , {bool next = false , bool delayed = false })
→ void
Register a subscription to be canceled when the device is disconnected.
This function simplifies cleanup, so you can prevent creating duplicate stream subscriptions.
clearGattCache ()
→ Future <void >
Refresh ble services & characteristics (Android Only)
connect ({Duration timeout = const Duration(seconds: 35) , int ? mtu = _mtuMax })
→ Future <void >
Establishes a connection to the Bluetooth Device.
timeout if timeout occurs, cancel the connection request and throw exception
mtu Android only. Request a larger mtu right after connection, if set.
createBond ({Uint8List ? pin , Duration timeout = const Duration(seconds: 90) })
→ Future <void >
Force the bonding popup to show now (Android Only)
Note! calling this is usually not necessary!! The platform does it automatically.
disconnect ({Duration timeout = const Duration(seconds: 35) , bool queue = true , Duration androidDelay = const Duration(seconds: 2) })
→ Future <void >
Cancels connection to the Bluetooth Device
discoverServices ({bool subscribeToServicesChanged = true , Duration timeout = const Duration(seconds: 15) })
→ Future <List <BluetoothService > >
Discover services, characteristics, and descriptors of the remote device
ensureConnected (String functionName )
→ void
noSuchMethod (Invocation invocation )
→ dynamic
Invoked when a nonexistent method or property is accessed.
inherited
openL2capChannel (int psm , {bool secure = false , Duration timeout = const Duration(seconds: 15) })
→ Future <BluetoothL2CapChannel >
Open an L2CAP connection-oriented channel to psm — a bidirectional byte
stream to the peer, independent of GATT (Android & iOS/macOS only; not
supported on Web).
Read the RSSI of connected remote device
removeBond ({Duration timeout = const Duration(seconds: 30) })
→ Future <void >
Remove bond (Android Only)
requestConnectionPriority ({required ConnectionPriority connectionPriorityRequest , Duration timeout = const Duration(seconds: 3) })
→ Future <void >
Request connection priority update (Android only)
requestMtu (int desiredMtu , {Duration predelay = const Duration(milliseconds: 350) , Duration timeout = const Duration(seconds: 15) })
→ Future <int >
Request to change MTU (Android Only)
setPreferredPhy ({required Set <Phy > txPhy , required Set <Phy > rxPhy , required PhyCoding option , Duration timeout = const Duration(seconds: 3) })
→ Future <void >
Set the preferred connection (Android Only)
toString ()
→ String
A string representation of this object.
override