toggleMute method

  1. @override
Future<void> toggleMute(
  1. MuteDuration? mute
)
override

Mutes or unmutes all the Chats of the authenticated MyUser.

Implementation

@override
Future<void> toggleMute(MuteDuration? mute) async {
  Log.debug('toggleMute($mute)', '$runtimeType');

  await _debounce(
    field: MyUserField.muted,
    current: () => myUser.value?.muted,
    saved: () async => (await _active)?.value.muted,
    value: mute,
    mutation: (duration, _) async {
      return await _graphQlProvider.toggleMyUserMute(
        duration == null
            ? null
            : Muting(
              duration: duration.forever == true ? null : duration.until,
            ),
      );
    },
    update: (v, _) => myUser.update((u) => u?.muted = v),
  );
}