Browse SDKs · Flutter
SDKsFlutter

Retrieve received friend applications

Retrieve friend applications received by the current Flutter user by page.

Copy
final items = await OpenIM.iMManager.friendshipManager
    .getFriendApplicationListAsRecipient(
  req: GetFriendApplicationListAsRecipientReq(offset: 0, count: 20),
);

Use handleResults in the request to filter by handling state. The pinned Flutter SDK does not expose a corresponding Dart enum, so pass only values explicitly defined by the server contract. offset and count control pagination.

The Future returns the current page as List<FriendApplicationInfo>. This query establishes a snapshot only and does not trigger application events.

Synchronize friend-application changes

This page owns state handling for the friend-application listener. Locate an application by fromUserID:toUserID:

void handleFriendApplicationChanged(FriendApplicationInfo item) {
  mergeFriendApplication(item);
}

void handleFriendApplicationDeleted(FriendApplicationInfo item) {
  removeFriendApplication(item.fromUserID, item.toUserID);
}

In the application's single OnFriendshipListener, route onFriendApplicationAdded, onFriendApplicationAccepted, and onFriendApplicationRejected to handleFriendApplicationChanged. Route onFriendApplicationDeleted to handleFriendApplicationDeleted. See Events overview for the complete composition entry point.

Use toUserID == currentUserID to distinguish received applications from sent applications. The Flutter SDK does not expose a method for deleting application records. Do not simulate deletion by rejecting an application or deleting a friend relationship.