SDKsFlutter
Add a friend
Send a friend application with a verification remark using the OpenIM Flutter SDK.
Send a friend request to a target user with an optional verification remark:
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
userID | String | Yes | Target user ID to add as a friend. |
reason | String | No | Optional verification remark message. |
Code example
await OpenIM.iMManager.friendshipManager.addFriend(
userID: 'user_b',
reason: 'Hi, I am Alex',
);Return value
A successful Future indicates that the friend application was accepted and queued by the server.
State changes after the call
A successful call signifies only that the application has been transmitted; it does not establish a friendship immediately. Once the recipient approves the request, both users receive friend addition events via their listeners. To monitor the status of sent applications, see Get friend application list as applicant.
Was this page helpful?