acceptConnection method

Future<bool> acceptConnection(
  1. String endpointId, {
  2. required OnPayloadReceived onPayLoadRecieved,
  3. OnPayloadTransferUpdate? onPayloadTransferUpdate,
})

Needs be called by both discoverer and advertiser to connect

Call this in OnConnectionInitiated to accept an incoming connection

OnConnectionResult is called on both only if both of them accept the connection

Implementation

Future<bool> acceptConnection(
  String endpointId, {
  required OnPayloadReceived onPayLoadRecieved,
  OnPayloadTransferUpdate? onPayloadTransferUpdate,
}) async {
  _onPayloadReceived = onPayLoadRecieved;
  _onPayloadTransferUpdate = onPayloadTransferUpdate;

  return await _channel.invokeMethod(
        'acceptConnection',
        <String, dynamic>{
          'endpointId': endpointId,
        },
      ) ??
      false;
}