Users overview
Understand user profiles, friend relationships, the blocklist, and online status in OpenIMClientSDK.
OpenIMClientSDK identifies each user by userID. When implementing profile cards, friend requests, contacts, or a blocklist, distinguish an application's public user profile from the current user's friend relationship and blocklist state.
Group member lists, in-group nicknames, group roles, and member administration belong to the Groups domain. See Retrieve group members.
User types
OpenIMSDK returns different user objects for different scenarios:
| Type | Use case | Main APIs |
|---|---|---|
UserInfo | The current user's profile, settings page, avatar, nickname, and global receive setting | getSelfUserInfo(), setSelfInfo() |
PublicUserInfo | Application user lookup, friend candidates, and profiles for users who are not friends | getUsersInfo() |
FriendInfo | The current user's friend list, friend remarks, and relationship extension data. The SDK model does not contain isPinned | getFriendListPage(), getFriendsInfo() |
BlacklistInfo | Users blocked by the current user | getBlacklist(), addBlacklist(), removeBlacklist() |
UserStatusInfo | User online status and active platforms | subscribeUsersStatus(), getSubscribeUsersStatus() |
The same userID can appear in public profile, friend, blocklist, and group member data. Prefer FriendInfo when displaying a contact, PublicUserInfo when only a public account profile is needed, and GroupMembersInfo for a group member. Conversation-list and chat-page titles belong to conversation data and should use ConversationInfo.showName.
Feature entry points
| Requirement | Recommended page |
|---|---|
Retrieve public profiles by userID for friend candidates or profile cards | Retrieve public profiles by user ID |
| Page through, search, or retrieve friend relationships by ID | Retrieve the friend list by page |
| Send, retrieve, accept, or reject friend applications | Retrieve received friend applications |
| Update friend data | updateFriends() |
| Delete a friend relationship | deleteFriend() |
| View and maintain the current user's blocklist | Retrieve the blocklist |
| Read or update the current user's nickname, avatar, and extension data | Update the current user's profile |
| Configure account-level message reception and do-not-disturb behavior | Set the global message receive option |
| Subscribe to and retrieve online status | Subscribe to user status |
| Retrieve or search group members and read specified member profiles | Retrieve group members |
State updates
Each capability page owns the listener and merge behavior for its user-related events:
- Current-user profile changes: Update the current user's profile.
- Friend-application changes: Retrieve received friend applications.
- Friend relationship and profile changes: Retrieve the friend list by page.
- Blocklist changes: Block a user.
- Online-status changes: Subscribe to user status.
In the Flutter SDK, UserManager and FriendshipManager each retain one listener. Combine the required callbacks in a shared state layer and set each listener once. Do not let multiple widgets overwrite one another's listeners.
Was this page helpful?