connectionStateStream property
Stream of connection state changes
Implementation
@override
Stream<BluetoothConnectionState> get connectionStateStream {
_connectionStateStream ??= _connectionStateChannel
.receiveBroadcastStream()
.map((event) {
final state = BluetoothConnectionState.values[event['state']];
_currentState = state;
if (state == BluetoothConnectionState.disconnected) {
_connectedDevice = null;
}
return state;
});
return _connectionStateStream!;
}