toggleMute method

Future<void> toggleMute(
  1. bool enabled
)

Toggles MyUser.muted status.

Implementation

Future<void> toggleMute(bool enabled) async {
  if (!isMuting.value) {
    isMuting.value = true;

    try {
      await _myUserService.toggleMute(
        enabled ? null : MuteDuration.forever(),
      );
    } on ToggleMyUserMuteException catch (e) {
      MessagePopup.error(e);
    } catch (e) {
      MessagePopup.error(e);
      rethrow;
    } finally {
      isMuting.value = false;
    }
  }
}