toggleMute method

Future<void> toggleMute()

Function to mute/unmute the microphone

Implementation

Future<void> toggleMute() async {
  var status = await Permission.microphone.status;
  if (value.isLocalUserMuted && status.isDenied) {
    await Permission.microphone.request();
  }
  value = value.copyWith(isLocalUserMuted: !(value.isLocalUserMuted));
  await value.engine?.muteLocalAudioStream(value.isLocalUserMuted);
}