editMessage method

Future<void> editMessage(
  1. CubeMessage message,
  2. bool isLast
)

Edits the message using chat connection. Opponent(s) will receive event about it to the listener:

CubeChatConnection.instance.messagesStatusesManager!.editedStream.listen((status) {
    // the message was edited, update your UI
});

message - the original message to update. This message should contain body(updated body), messageId and dialogId.

Throws an IllegalArgumentException if body or messageId or dialogId is empty.

Implementation

Future<void> editMessage(CubeMessage message, bool isLast) {
  Completer<void> completer = Completer();

  checkInit().then((chat) {
    completer.complete(chat.editMessage(message, isLast));
  }).catchError((onError) {
    completer.completeError(onError);
  });

  return completer.future;
}