ChatEventHandler class
The chat event handler.
This handler is used to check whether messages are received. If messages are sent successfully, a delivery receipt will be returned (delivery receipt needs to be enabled: ChatOptions.requireDeliveryAck. If the peer user reads the received message, a read receipt will be returned (read receipt needs to be enabled: ChatOptions.requireAck). This API should be implemented in the app to listen for message status changes.
Adds chat event handler:
ChatClient.getInstance.chatManager.addEventHandler(UNIQUE_HANDLER_ID, ChatEventHandler());
Removes a chat event handler:
ChatClient.getInstance.chatManager.removeEventHandler(UNIQUE_HANDLER_ID);
Constructors
-
ChatEventHandler({void onMessagesReceived(List<
ChatMessage> messages)?, void onCmdMessagesReceived(List<ChatMessage> messages)?, void onMessagesRead(List<ChatMessage> messages)?, void onGroupMessageRead(List<ChatGroupMessageAck> groupMessageAcks)?, VoidCallback? onReadAckForGroupMessageUpdated, void onMessagesDelivered(List<ChatMessage> messages)?, void onMessagesRecalled(List<ChatMessage> messages)?, VoidCallback? onConversationsUpdate, void onConversationRead(String from, String to)?, void onMessageReactionDidChange(List<ChatMessageReactionEvent> events)?, void onMessageContentChanged(ChatMessage message, String operatorId, int operationTime)?}) - The chat event handler.
Properties
- hashCode → int
-
The hash code for this object.
read-onlyinherited
-
onCmdMessagesReceived
→ (void Function(List<
ChatMessage> messages)?) -
Occurs when a command message is received.
final
- onConversationRead → (void Function(String from, String to)?)
-
Occurs when a conversation read receipt is received.
final
- onConversationsUpdate → VoidCallback?
-
Occurs when the conversation updated.
final
-
onGroupMessageRead
→ (void Function(List<
ChatGroupMessageAck> groupMessageAcks)?) -
Occurs when a read receipt is received for a group message.
final
- onMessageContentChanged → (void Function(ChatMessage message, String operatorId, int operationTime)?)
-
Occurs when the message content is modified.
final
-
onMessageReactionDidChange
→ (void Function(List<
ChatMessageReactionEvent> events)?) -
Occurs when the Reaction data changes.
final
-
onMessagesDelivered
→ (void Function(List<
ChatMessage> messages)?) -
Occurs when a delivery receipt is received.
final
-
onMessagesRead
→ (void Function(List<
ChatMessage> messages)?) -
Occurs when a read receipt is received for a message.
final
-
onMessagesRecalled
→ (void Function(List<
ChatMessage> messages)?) -
Occurs when a received message is recalled.
final
-
onMessagesReceived
→ (void Function(List<
ChatMessage> messages)?) -
Occurs when a message is received.
final
- onReadAckForGroupMessageUpdated → VoidCallback?
-
Occurs when the update for the group message read status is received.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
read-onlyinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited