toMap method

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

Implementation

@override
Map<String, Object?> toMap() {
  final data = <String, Object?>{
    'title': title,
    'body': body,
    'trigger': trigger.name,
    'action': action,
    'attachments': attachments?.map((a) => a.toMap()).toList(),
    'bodyLocArgs': bodyLocArgs,
    'bodyLocKey': bodyLocKey,
    'category': category,
    'contentAvailable': contentAvailable,
    'group': group,
    'icon': icon,
    'notificationCount': notificationCount,
    'notificationTimestamp': notificationTimestamp,
    'sound': sound,
    'subtitle': subtitle,
    'tag': tag,
    'threadIdentifier': threadIdentifier,
    'titleLocArgs': titleLocArgs,
    'titleLocKey': titleLocKey,
  };
  data.removeWhere((key, value) => value == null);
  return data;
}