call method Null safety

Future<void> call(
  1. String userName,
  2. {RTCSessionDescription? offer}
)

Call other participant

sends request with payload as: { "request" : "call", "username" : userName } along with the payload it internally creates the offer with sendRecv true and sends it.

Optionally you can provide your own offer if you want, in offer property.

Since it is asynchronous request result can only be extracted from event messages

Implementation

Future<void> call(String userName, {RTCSessionDescription? offer}) async {
  var payload = {"request": "call", "username": userName};
  if (offer == null) {
    offer = await createOffer(
        audioSend: true, videoSend: true, audioRecv: true, videoRecv: true);
  }
  await this.send(data: payload, jsep: offer);
}