toJson method

Map<String, dynamic> toJson()

Implementation

Map<String, dynamic> toJson() => {
      if (sound != null) "sound": sound,
      if (clickAction != null) "click_action": clickAction,
      if (color != null) "color": color,
      if (tag != null) "tag": tag,
      if (bodyLocKey != null) "body_loc_key": bodyLocKey,
      if (bodyLocArgs != null && bodyLocArgs!.isNotEmpty)
        "body_loc_args": List<dynamic>.from(bodyLocArgs!.map((x) => x)),
      if (titleLocKey != null) "title_loc_key": titleLocKey,
      if (titleLocArgs != null && titleLocArgs!.isNotEmpty)
        "title_loc_args": List<dynamic>.from(titleLocArgs!.map((x) => x)),
      if (channelId != null) "channel_id": channelId,
      if (sticky != null) "sticky": sticky,
      if (eventTime != null) "event_time": eventTime?.toIso8601String(),
      if (localOnly != null) "local_only": localOnly,
      if (defaultSound != null) "default_sound": defaultSound,
      if (defaultVibrateTimings != null)
        "default_vibrate_timings": defaultVibrateTimings,
      if (defaultLightSettings != null)
        "default_light_settings": defaultLightSettings,
      if (vibrateTimings != null && vibrateTimings!.isNotEmpty)
        "vibrate_timings": List<dynamic>.from(vibrateTimings!.map((x) => x)),
      if (visibility != null) "visibility": visibility?.name,
      if (notificationPriority != null)
        "notification_priority": notificationPriority,
      if (notificationCount != null) "notification_count": notificationCount,
      if (lightSettings != null) "light_settings": lightSettings?.toJson(),
    };