copyWith method

UserPreferencesModel copyWith({
  1. bool? globalNotificationsEnabled,
  2. bool? soundEnabled,
  3. bool? vibrationEnabled,
  4. bool? badgeEnabled,
  5. NotificationAlertStyle? alertStyle,
  6. bool? showPreviews,
  7. bool? groupNotifications,
  8. bool? notificationHistory,
  9. bool? criticalAlertsEnabled,
  10. bool? scheduledDelivery,
  11. QuietHoursSettings? quietHours,
  12. Map<String, CategoryPreference>? categoryPreferences,
  13. List<String>? blockedSenders,
  14. List<String>? allowedSenders,
  15. DateTime? lastUpdated,
})

Creates a copy of these preferences with updated fields.

Implementation

UserPreferencesModel copyWith({
  bool? globalNotificationsEnabled,
  bool? soundEnabled,
  bool? vibrationEnabled,
  bool? badgeEnabled,
  NotificationAlertStyle? alertStyle,
  bool? showPreviews,
  bool? groupNotifications,
  bool? notificationHistory,
  bool? criticalAlertsEnabled,
  bool? scheduledDelivery,
  QuietHoursSettings? quietHours,
  Map<String, CategoryPreference>? categoryPreferences,
  List<String>? blockedSenders,
  List<String>? allowedSenders,
  DateTime? lastUpdated,
}) {
  return UserPreferencesModel(
    globalNotificationsEnabled:
        globalNotificationsEnabled ?? this.globalNotificationsEnabled,
    soundEnabled: soundEnabled ?? this.soundEnabled,
    vibrationEnabled: vibrationEnabled ?? this.vibrationEnabled,
    badgeEnabled: badgeEnabled ?? this.badgeEnabled,
    alertStyle: alertStyle ?? this.alertStyle,
    showPreviews: showPreviews ?? this.showPreviews,
    groupNotifications: groupNotifications ?? this.groupNotifications,
    notificationHistory: notificationHistory ?? this.notificationHistory,
    criticalAlertsEnabled:
        criticalAlertsEnabled ?? this.criticalAlertsEnabled,
    scheduledDelivery: scheduledDelivery ?? this.scheduledDelivery,
    quietHours: quietHours ?? this.quietHours,
    categoryPreferences: categoryPreferences ?? this.categoryPreferences,
    blockedSenders: blockedSenders ?? this.blockedSenders,
    allowedSenders: allowedSenders ?? this.allowedSenders,
    lastUpdated: lastUpdated ?? this.lastUpdated,
  );
}