call method Null safety

Future<void> call(
  1. String uri,
  2. {String? callId,
  3. String? referId,
  4. String? srtp,
  5. String? secret,
  6. String? ha1Secret,
  7. String? authuser,
  8. Map<String, dynamic>? headers,
  9. String? srtpProfile,
  10. bool? autoAcceptReInvites,
  11. RTCSessionDescription? offer}
)

initiate sip call invite to provided sip uri. uri : SIP URI to call; mandatory callId : user-defined value of Call-ID SIP header used in all SIP requests throughout the call; optional referId : in case this is the result of a REFER, the unique identifier that addresses it; optional headers : object with key/value mappings (header name/value), to specify custom headers to add to the SIP INVITE; optional srtp : whether to mandate (sdes_mandatory) or offer (sdes_optional) SRTP support; optional srtpProfile : SRTP profile to negotiate, in case SRTP is offered; optional autoAcceptReInvites : whether we should blindly accept re-INVITEs with a 200 OK instead of relaying the SDP to the application; optional, TRUE by default offer : note it by default sends only audio sendrecv offer

Implementation

Future<void> call(String uri,
    {String? callId,
    String? referId,
    String? srtp,
    String? secret,
    String? ha1Secret,
    String? authuser,
    Map<String, dynamic>? headers,
    String? srtpProfile,
    bool? autoAcceptReInvites,
    RTCSessionDescription? offer}) async {
  var payload = {
    "request": "call",
    "call_id": callId,
    "uri": uri,
    "refer_id": referId,
    "headers": headers,
    "autoaccept_reinvites": autoAcceptReInvites,
    "srtp": srtp,
    "srtp_profile": srtpProfile,
    "secret": secret, //"<password to use to register; optional>",
    "ha1_secret":
        ha1Secret, //"<prehashed password to use to register; optional>",
    "authuser":
        authuser, //"<username to use to authenticate (overrides the one in the SIP URI); optional>",
  }..removeWhere((key, value) => value == null);
  if (offer == null) {
    offer = await this.createOffer(
        videoSend: false, videoRecv: false, audioSend: true, audioRecv: true);
  }
  JanusEvent response =
      JanusEvent.fromJson(await this.send(data: payload, jsep: offer));
  JanusError.throwErrorFromEvent(response);
}