Browse SDKs · Flutter
Platform
SDKsFlutter

Delete a friend

Remove a specified user from the current user friend list using the OpenIM Flutter SDK.

Copy

Remove a user from the currently signed-in user's friend list:

Parameters

ParameterTypeRequiredDescription
userIDStringYesTarget user ID to remove from friends.

Code example

await OpenIM.iMManager.friendshipManager.deleteFriend(
  userID: 'user_123',
);

Return value

A successful Future returns void, indicating that the deletion request was processed by the server and friendship records were removed locally.

State changes after the call

This method alters relationship states. Upon successful deletion, the current client and other signed-in sessions for this account receive onFriendDeleted events. The client should remove the corresponding entry from the local contacts cache using userID as the key. For friend event listening and state synchronization, see Get friend list with pagination.