insertMessage method Null safety
- EMMessage message
Inserts a message to a conversation in the local database and the SDK will automatically update the lastest message.
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 {@link EMError}.
Implementation
Future<void> insertMessage(EMMessage message) async {
Map req = this._toJson();
req['msg'] = message.toJson();
Map result = await _emConversationChannel.invokeMethod(
ChatMethodKeys.insertMessage, req);
try {
EMError.hasErrorFromResult(result);
} on EMError catch (e) {
throw e;
}
}