Browse SDKs · Flutter
Platform
SDKsFlutter

Accept a friend application

Accept an incoming friend application and establish a friendship using the OpenIM Flutter SDK.

Copy

Accept a friend application sent by another user to formally establish a bilateral friendship:

Parameters

ParameterTypeRequiredDescription
userIDStringYesUser ID of the applicant who submitted the friend request.
handleMsgStringNoOptional remark message attached when approving the request.

Code example

await OpenIM.iMManager.friendshipManager.acceptFriendApplication(
  userID: applicantUserID,
  handleMsg: 'Approved',
);

Return value

A successful Future indicates that the server accepted the friend request and established the friendship.

State changes after the call

Upon success, update the applicant's record to approved using their userID as the key, and merge the new friend into the local contacts cache by userID. The SDK notifies connected clients of friend application updates and friend additions via listener callbacks. For application record handling, see Get friend application list as recipient; for friend list synchronization, see Get friend list with pagination.