leave method

Future<void> leave()

Implementation

Future<void> leave() async {
  await dispose();
  setState(GroupCallState.LocalCallFeedUninitialized);
  voip.currentGroupCID = null;
  await voip.delegate.handleGroupCallEnded(this);
  final justLeftGroupCall = voip.groupCalls.tryGet<GroupCall>(room.id);
  // terminate group call if empty
  if (justLeftGroupCall != null &&
      justLeftGroupCall.intent != 'm.room' &&
      justLeftGroupCall.participants.isEmpty &&
      room.canCreateGroupCall) {
    await terminate();
  } else {
    Logs().d(
        '[VOIP] left group call but cannot terminate. participants: ${participants.length}, pl: ${room.canCreateGroupCall}');
  }
}