Browse SDKs · Flutter
SDKsFlutter

Block a user

Add a user to the current account’s blocklist with the OpenIM Flutter SDK.

Copy
await OpenIM.iMManager.friendshipManager.addBlacklist(
  userID: targetUserID,
  ex: '{"source":"profile-menu"}',
);

Blocking is a one-way relationship: the blocked user cannot send messages to the current user, but the current user may still be able to message them. ex is a complete string value. A successful Future does not mean the event has already arrived.

This page owns onBlackAdded. Include it in the application's single OnFriendshipListener, and insert or replace the record by userID.