Unblock a user
Remove a specified user from the current user blocklist using the OpenIM Flutter SDK.
Remove a specified user from the currently signed-in user's blocklist:
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
userID | String | Yes | Target user ID to remove from the blocklist. |
Code example
await OpenIM.iMManager.friendshipManager.removeBlacklist(
userID: 'user_123',
);Return value
A successful Future returns void, indicating that the unblock request was processed by the server and removed from local storage.
State changes after the call
This method alters relationship states. Once the unblock operation completes, the user regains the ability to send single-chat messages to the current user.
Listen for unblock events
Handle unblock events centrally. When the removal is processed on the server, connected client sessions receive onBlackDeleted event notifications. Use userID as the key to remove the entry from local blocklist stores:
void handleBlackDeleted(BlacklistInfo info) {
final userID = info.userID;
if (userID != null) removeBlockedUser(userID);
}The Flutter SDK maintains a single OnFriendshipListener instance inside FriendshipManager. Register this handler through the application-wide entry point described in Events overview. To recalibrate the full blocklist snapshot, see Retrieve a list of blocked users.
Was this page helpful?