translateMessage method

Future<ChatMessage> translateMessage(
  1. {required ChatMessage msg,
  2. required List<String> languages}

Translates a text message.

Param msg The message object for translation.

Param languages The list of target language codes.

Return The translated message.

Throws A description of the exception. See ChatError.


Future<ChatMessage> translateMessage({
  required ChatMessage msg,
  required List<String> languages,
}) async {
  Map req = {};
  req["message"] = msg.toJson();
  req["languages"] = languages;
  Map result =
      await ChatChannel.invokeMethod(ChatMethodKeys.translateMessage, req);
  try {
    return ChatMessage.fromJson(result[ChatMethodKeys.translateMessage]);
  } on ChatError catch (e) {
    throw e;