appendMessage method

Future<void> appendMessage(
  1. ChatMessage message
)

Inserts a message to the end of a conversation in the local database.

Make sure you set the conversation ID as that of the conversation where you want to insert the message.

Param message The message instance.

Throws A description of the exception. See ChatError.

Implementation

Future<void> appendMessage(ChatMessage message) async {
  try {
    Map req = _toJson();
    req['msg'] = message.toJson();
    Map result = await platform_interface.Client.instance.conversationManager
        .callNativeMethod(ChatMethodKeys.appendMessage, req);
    ChatError.hasErrorFromResult(result);
  } catch (e) {
    rethrow;
  }
}