Skip to content

Commit ab3c7f1

Browse files
committed
Expose autoConnect as a parameter to connect().
1 parent f3daf21 commit ab3c7f1

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

lib/src/flutter_blue.dart

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,11 +96,14 @@ class FlutterBlue {
9696
/// Returns a stream of [BluetoothDeviceState]
9797
/// Timeout closes the stream after a specified [Duration]
9898
/// To cancel connection to device, simply cancel() the stream subscription
99-
Stream<BluetoothDeviceState> connect(BluetoothDevice device,
100-
{Duration timeout}) async* {
99+
Stream<BluetoothDeviceState> connect(
100+
BluetoothDevice device, {
101+
Duration timeout,
102+
bool autoConnect = true,
103+
}) async* {
101104
var request = protos.ConnectRequest.create()
102105
..remoteId = device.id.toString()
103-
..androidAutoConnect = true;
106+
..androidAutoConnect = autoConnect;
104107
var connected = false;
105108
StreamSubscription subscription;
106109
StreamController controller;

0 commit comments

Comments
 (0)