Chat / Flutter
Current version: v3
Chat Flutter v3
Chat Flutter
Chat
Flutter
Home
/
Chat
/
Flutter
/
Message

Copy a message

A user can copy and send their own message in the same channel or to another channel. Both user messages and file messages can be copied using the copyMessage() method.

try {
    final preMessage = channel.copyMessage(MESSAGE_TO_COPY, TARGET_CHANNEL, onCompleted: (msg, error) {
        // MESSAGE_TO_COPY can be either UserMessage or FileMessage.
        // The message is successfully copied to the target channel.
    });
} catch (e) {
    // Handle error.
}

List of parameters

Parameter nameTypeDescription

message

BaseMessage

Specifies a type of message to copy. Acceptable values are UserMessage or FileMessage.

targetChannel

BaseChannel

Specifies a target channel to send a copied message to.

onCompleted

Function(BaseMessage, error)

Specifies the callback handler to receive the response from Sendbird server for a message copy request.