translateUserMessage method Null safety

Future<UserMessage> translateUserMessage(
  1. {required ChannelType channelType,
  2. required String channelUrl,
  3. required int messageId,
  4. required List<String> targetLanguages}
)

Implementation

Future<UserMessage> translateUserMessage({
  required ChannelType channelType,
  required String channelUrl,
  required int messageId,
  required List<String> targetLanguages,
}) async {
  final url =
      endpoint.Channels.channelurl_messages_messageid_translation.format([
    channelType.urlString,
    channelUrl,
    messageId,
  ]);
  final body = {'target_langs': targetLanguages};
  final res = await client.post(url: url, body: body);
  return BaseMessage.msgFromJson<UserMessage>(res,
      channelType: channelType)!; //mark!
}