cancel static method

Future<V2TimCallback> cancel({
  1. required String inviteID,
  2. String? data,
})

Implementation

static Future<V2TimCallback> cancel({
  required String inviteID,
  String? data,
}) async {
  print(currentInvite);
  if (currentInvite["inviteID"] != null) {
    List<String> inviteeList = List<String>.from(currentInvite["inviteeList"]);
    String customData = _buildSignalData(
      type: V2SignalingActionType.SIGNALING_ACTION_TYPE_CANCEL_INVITE,
      customData: data ?? "",
      inviteID: inviteID,
      timeout: currentInvite["timeout"],
      groupID: currentInvite["groupID"],
      inviteeList: inviteeList,
      inviter: currentInvite["inviter"],
    );
    if (inviteeList.isNotEmpty) {
      int code = await _sendCustomData(
        data: customData,
        groupID: currentInvite["groupID"] ?? "",
        toUserId: _isGroupCall(currentInvite) ? "" : inviteeList.first,
      );
      currentInvite = {};
      if (timeoutTimer[inviteID] != null) {
        timeoutTimer[inviteID]!.cancel();
        timeoutTimer[inviteID] = null;
      }
      return V2TimCallback(code: code, desc: code == 0 ? "success" : "error");
    }
  }
  return V2TimCallback(
    code: 8010,
    desc: "inviteID is invalid or invitation has been processed",
  );
}