connect method

  1. @override
Stream<ConnectionEvent> connect(
  1. String deviceAddress
)
override

Connect to a BLE device Returns a stream of connection events

Implementation

@override
Stream<ConnectionEvent> connect(String deviceAddress) {
  // Start connection via method channel
  methodChannel.invokeMethod('connect', {'deviceAddress': deviceAddress});

  // Return the BLE connection event stream
  _bleConnectionStream ??=
      _bleConnectionEventChannel.receiveBroadcastStream().map((data) {
    return ConnectionEvent.fromMap(Map<String, dynamic>.from(data));
  });
  return _bleConnectionStream!;
}