Update self profile
Update the nickname, avatar, and custom extensions of the currently logged-in user using the OpenIM Flutter SDK.
Modify the nickname, avatar URL, or custom business extensions of the currently logged-in user:
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
nickname | String? | No | New user display nickname. Providing a trimmed non-empty string is recommended. |
faceURL | String? | No | Full remote URL of the user's new avatar image. |
ex | String? | No | Custom business extension string. Passing a new value overwrites existing extension text without automatically merging JSON properties. |
Supply only the fields that are being modified; omitted fields retain their existing values on the server.
Code example
await OpenIM.iMManager.userManager.setSelfInfo(
nickname: 'New Nickname',
faceURL: 'https://example.com/avatar.png',
ex: '{"customTheme":"dark"}',
);Return value
A successful Future returns void, indicating that the profile update request was accepted and applied by the server.
State changes after the call
This method alters user profile state. Future completion represents request processing; it is distinct from event delivery across other client devices.
While globalRecvMsgOpt belongs to the same user profile data structure, it controls account-wide notification policies and should be managed via its dedicated method; see Set global message reception.
Listen for self profile updates
Handle profile modifications centrally. When the server completes the update, all active client sessions for this account receive onSelfInfoUpdated event notifications. Use userID as the key to update cached user profile state:
void handleSelfInfoUpdated(UserInfo info) {
mergeSelfInfo(info);
}The Flutter SDK maintains a single OnUserListener instance inside UserManager. Configure this callback inside the consolidated application entry point described in Events overview.
To fetch the full profile snapshot from scratch, see Get self profile.
Was this page helpful?