translateUserMessage method Null safety

Future<UserMessage> translateUserMessage(
  1. UserMessage message,
  2. List<String> targetLanguages
)

Translates a message with given list of targetLanguages.

An element of target language should be from http://www.lingoes.net/en/translator/langcode.htm

Implementation

Future<UserMessage> translateUserMessage(
  UserMessage message,
  List<String> targetLanguages,
) async {
  if (message.messageId <= 0) {
    throw InvalidParameterError();
  }
  if (targetLanguages.isEmpty) {
    throw InvalidParameterError();
  }

  return _sdk.api.translateUserMessage(
    channelType: channelType,
    channelUrl: channelUrl,
    messageId: message.messageId,
    targetLanguages: targetLanguages,
  );
}