copyWith method

NotificationSettings copyWith({
  1. String? title,
  2. String? body,
  3. String? stopButton,
  4. String? androidSnoozeButton()?,
  5. String? icon,
  6. Color? iconColor,
  7. bool? keepNotificationAfterAlarmEnds,
})

Creates a copy of this notification settings but with the given fields replaced with the new values.

Implementation

NotificationSettings copyWith({
  String? title,
  String? body,
  String? stopButton,
  String? Function()? androidSnoozeButton,
  String? icon,
  Color? iconColor,
  bool? keepNotificationAfterAlarmEnds,
}) {
  return NotificationSettings(
    title: title ?? this.title,
    body: body ?? this.body,
    stopButton: stopButton ?? this.stopButton,
    // Wrapped so a caller can remove the snooze action; the older nullable
    // fields keep their existing signatures for compatibility.
    androidSnoozeButton: androidSnoozeButton != null
        ? androidSnoozeButton()
        : this.androidSnoozeButton,
    icon: icon ?? this.icon,
    iconColor: iconColor ?? this.iconColor,
    keepNotificationAfterAlarmEnds:
        keepNotificationAfterAlarmEnds ?? this.keepNotificationAfterAlarmEnds,
  );
}