toggleMute method
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);
}