toJson method Null safety

Map<String, dynamic> toJson()

Implementation

Map<String, dynamic> toJson() {
  final ret = <String, dynamic>{
    'message': message,
    'scheduled_at': scheduledAt,
    'send_push': sendPush,
    'is_silent': isSilent,
    'mark_as_read': markAsRead,
    'dedup_id': dedupId,
    'apns_bundle_id': apnsBundleId,
    'sound': appleCriticalAlertOptions?.sound,
    'volume': appleCriticalAlertOptions?.volume,
    'target_langs': translationTargetLanguages,
    'req_id': reqId,
    'data': data,
    'custom_type': customType,
    'push_option': pushOption.toString().split('.').last,
    'mention_type': mentionType.toString().split('.').last,
    'mentionedUserIds': mentionedUserIds,
    'meta_arrays': metaArrays,
  };
  ret.removeWhere((key, value) => value == null);
  return ret;
}