toJson method

Map<String, dynamic> toJson()

Implementation

Map<String, dynamic> toJson() {
  final ret = <String, dynamic>{
    'data': data,
    'custom_type': customType,
    'mention_type': mentionType.asString(),
    if (mentionType == MentionType.users)
      'mentioned_user_ids': mentionedUserIds,
    'metaarray': metaArrays?.map((e) => e.toJson()).toList(),
    'parent_message_id': parentMessageId,
    'reply_to_channel': replyToChannel,
    if (pushNotificationDeliveryOption ==
        PushNotificationDeliveryOption.suppress)
      'push_option': pushNotificationDeliveryOption.asString(),
    'pin_message': isPinnedMessage,
  };

  ret.removeWhere((key, value) => value == null);
  return ret;
}