addConversationListener
Introduction
Add conversation listener
You can receive the changing events of conversation list, after adding a conversation listener.
Adding a conversation listener by
addConversationListener
.
Parameter details
Parameter name | Parameter type | Required | Platform | Description |
---|---|---|---|---|
listener | V2TimConversationListener | yes | All | The conversation listener to add. |
Returned template
void
Return value details
This function has no return value
Code example
V2TimConversationListener listener = V2TimConversationListener(
onConversationChanged: (List<V2TimConversation> conversationList) {},
onConversationGroupCreated:
(String groupName, List<V2TimConversation> conversationList) {},
onConversationGroupDeleted: (String groupName) {},
onConversationGroupNameChanged: (String oldName, String newName) {},
onConversationsAddedToGroup:
(String groupName, List<V2TimConversation> conversationList) {},
onConversationsDeletedFromGroup:
(String groupName, List<V2TimConversation> conversationList) {},
onNewConversation: (List<V2TimConversation> conversationList) {},
onSyncServerFailed: () {},
onSyncServerFinish: () {},
onSyncServerStart: () {},
onTotalUnreadMessageCountChanged: (int totalUnreadCount) {},
);
TencentImSDKPlugin.v2TIMManager
.getConversationManager()
.addConversationListener(listener: listener);