connect method

Future<void> connect(
  1. AdHocDevice device, [
  2. int? attempts
])

Attempts to connect to a remote peer.

The connection to device process is attempted.

if attempts is set, then it is done "attempts" times. Otherwise, the connection is only attempted once.

Throws a DeviceFailureException if the Wi-Fi/Bluetooth adapter is not enabled.

Implementation

Future<void> connect(AdHocDevice device, [int? attempts]) async {
  if (_datalinkManager.checkState() == 0) {
    throw DeviceFailureException('No wifi and bluetooth connectivity');
  }

  await _datalinkManager.connect(attempts ?? 1, device);
}