pair method

Future<void> pair({
  1. BleCommand? pairingCommand,
  2. Duration? timeout,
})

Pair a device.

It throws error if pairing fails.

On Apple and Web, it only works on devices with encrypted characteristics. It is advised to pass a pairingCommand with an encrypted read or write characteristic. When not passing a pairingCommand, you should afterwards use isPaired with a pairingCommand to verify the pairing state.

On Web/Windows and Web/Linux, it does not work for devices that use ConfirmOnly pairing. Can throw PairingException, ConnectionException or PlatformException.

Implementation

Future<void> pair({
  BleCommand? pairingCommand,
  Duration? timeout,
}) {
  return UniversalBle.pair(
    deviceId,
    pairingCommand: pairingCommand,
    timeout: timeout,
  );
}