toMap method

  1. @override
Map<String, dynamic> toMap()

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>{
    'isEnabled': isEnabled.toSerializable,
    'allowSound': allowSound.toSerializable,
    'allowVibration': allowVibration.toSerializable,
    'allowLights': allowLights.toSerializable,
    'allowBadge': allowBadge.toSerializable,
    'soundPath': soundPath.toSerializable,
    'vibrationPattern': vibrationPattern
        ?.map((int value) => value.toSerializable)
        .toList(),
    'quietHoursEnabled': quietHoursEnabled.toSerializable,
    'quietHoursStart': quietHoursStart?.toMap().toSerializable,
    'quietHoursEnd': quietHoursEnd?.toMap().toSerializable,
    'channels': channels
        .map(
          (String key, NotificationChannelSettings value) =>
              MapEntry<String, Map<String, dynamic>>(key, value.toMap()),
        )
        .toSerializable,
    'groupSettings': groupSettings
        .map(
          (String key, NotificationGroupSettings value) =>
              MapEntry<String, Map<String, dynamic>>(key, value.toMap()),
        )
        .toSerializable,
  };
}