toMap method
Converts the BaseDataModel
object to a Map representation.
Returns a Map containing the key-value pairs of the object's properties.
Implementation
@override
Map<String, dynamic> toMap() {
return <String, dynamic>{
'globalNotificationsEnabled': globalNotificationsEnabled.toSerializable,
'soundEnabled': soundEnabled.toSerializable,
'vibrationEnabled': vibrationEnabled.toSerializable,
'badgeEnabled': badgeEnabled.toSerializable,
'alertStyle': alertStyle.name.toSerializable,
'showPreviews': showPreviews.toSerializable,
'groupNotifications': groupNotifications.toSerializable,
'notificationHistory': notificationHistory.toSerializable,
'criticalAlertsEnabled': criticalAlertsEnabled.toSerializable,
'scheduledDelivery': scheduledDelivery.toSerializable,
'quietHours': quietHours.toMap().toSerializable,
'categoryPreferences': categoryPreferences
.map(
(String key, CategoryPreference value) =>
MapEntry<String, Map<String, dynamic>>(key, value.toMap()),
)
.toSerializable,
'blockedSenders': blockedSenders.toSerializable,
'allowedSenders': allowedSenders.toSerializable,
'lastUpdated': lastUpdated?.toSerializable,
};
}