ChannelUserMessageUpdateApiRequest constructor Null safety

ChannelUserMessageUpdateApiRequest(
  1. {required ChannelType channelType,
  2. required String channelUrl,
  3. required int messageId,
  4. required UserMessageParams params,
  5. String? senderId,
  6. List<String>? additionalMentionedUserIds}
)

Implementation

ChannelUserMessageUpdateApiRequest({
  required ChannelType channelType,
  required String channelUrl,
  required int messageId,
  required UserMessageParams params,
  String? senderId,
  List<String>? additionalMentionedUserIds,
}) : super(userId: senderId) {
  url = '${channelType.urlString}/$channelUrl/messages/$messageId';

  body = {
    'message_type': CommandString.userMessage,
    'user_id': senderId ?? state.userId,
    if (additionalMentionedUserIds != null)
      'mentioned_user_ids': additionalMentionedUserIds,
  };

  body.addAll(params.toJson());
  body.removeWhere((key, value) => value == null);
}