Browse SDKs · Flutter
SDKsFlutter

Set the global message receive option

Set the current account’s default message reception and notification behavior with the OpenIM Flutter SDK.

Copy

Write globalRecvMsgOpt separately through setSelfInfo(). Do not overwrite this account-level message policy as a side effect of saving a nickname or avatar.

await OpenIM.iMManager.userManager.setSelfInfo(
  globalRecvMsgOpt: ReceiveMessageOpt.notNotify,
);
ConstantValueMeaning
ReceiveMessageOpt.receive0Receive messages normally and allow offline pushes or notifications.
ReceiveMessageOpt.notReceive1Do not receive messages or trigger offline pushes or notifications.
ReceiveMessageOpt.notNotify2Receive messages without triggering offline pushes or notifications.

If the product exposes only a global Do Not Disturb switch, it should generally toggle between receive and notNotify. Because notReceive stops message reception, present it as a separate option with different semantics.

An individual conversation can have its own receive option; see Set the conversation message receive option. A successful Future means only that the request completed. Reconcile the final account snapshot through onSelfInfoUpdated or another query; the event belongs to Update the current user’s profile.