Get friend application list as recipient
Query incoming friend applications received by the current user using pagination in Flutter.
Retrieve pending and processed incoming friend requests received by the currently logged-in user using pagination:
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
offset | int | No | Pagination offset index. Start at 0 for the first page. |
count | int | No | Number of application records to fetch per page. |
handleResults | List<int>? | No | Filter records by resolution status: 0 for pending, 1 for approved, -1 for rejected. |
Code example
final items = await OpenIM.iMManager.friendshipManager
.getFriendApplicationListAsRecipient(
req: GetFriendApplicationListAsRecipientReq(offset: 0, count: 20),
);Return value
A successful Future returns a list of incoming friend application records for the requested page (List<FriendApplicationInfo>).
Query operations return an immediate data snapshot and do not emit listener events. For application handling actions, see Accept a friend application and Refuse a friend application.
Synchronize friend application events
Listen to friend application events centrally and merge state incrementally using the composite key fromUserID:toUserID:
void handleFriendApplicationChanged(FriendApplicationInfo item) {
mergeFriendApplication(item);
}
void handleFriendApplicationDeleted(FriendApplicationInfo item) {
removeFriendApplication(item.fromUserID, item.toUserID);
}Within your single OnFriendshipListener, route onFriendApplicationAdded, onFriendApplicationAccepted, and onFriendApplicationRejected to handleFriendApplicationChanged, and route onFriendApplicationDeletedEnterprise to handleFriendApplicationDeleted. See Events overview for the consolidated registration entry point.
Distinguish incoming requests from outgoing requests by checking toUserID == currentUserID. The Flutter SDK does not expose a public method for deleting friend application history; do not simulate deletion by rejecting applications or deleting friends.
Was this page helpful?