Browse SDKs · Flutter
Platform
SDKsFlutter

Update friends

Update remarks, pinned status, or custom extensions for specified friends using the OpenIM Flutter SDK.

Copy

Update remarks, pin status, or custom business extensions for one or more friends:

Parameters

The UpdateFriendsReq object contains the following fields:

ParameterTypeRequiredDescription
friendUserIDsList<String>YesList of friend user IDs whose relationship details should be updated.
remarkString?NoCustom friend remark name.
isPinnedbool?NoWhether to pin this friend in contact views.
exString?NoCustom friendship extension string. Passing a new value overwrites existing extension data rather than merging keys incrementally.

Provide at least one property field to modify alongside friendUserIDs. If different friends require distinct remarks or extension attributes, invoke this API separately for each user.

Code example

await OpenIM.iMManager.friendshipManager.updateFriends(
  UpdateFriendsReq(
    friendUserIDs: ['user_123'],
    remark: 'Alice',
    isPinned: true,
  ),
);

Return value

A successful Future returns void, indicating that the update request was accepted and processed by the server.

State changes after the call

This method alters relationship states. When the server successfully updates the friend details, connected clients receive onFriendInfoChanged event notifications. The client should update the corresponding friend item in the local contacts cache using userID as the merge key. For friend event listening and state management, see Get friend list with pagination.