toMap method

Map<String, dynamic> toMap()

Implementation

Map<String, dynamic> toMap() {
  return {
    'senderId': senderId,
    'category': category,
    'collapseKey': collapseKey,
    'contentAvailable': contentAvailable,
    'data': data,
    'from': from,
    'messageId': messageId,
    'mutableContent': mutableContent,
    'notification': notification == null
        ? null
        : {
            'title': notification?.title,
            'titleLocArgs': notification?.titleLocArgs,
            'titleLocKey': notification?.titleLocKey,
            'body': notification?.body,
            'bodyLocArgs': notification?.bodyLocArgs,
            'bodyLocKey': notification?.bodyLocKey,
            'android': notification?.android == null
                ? null
                : {
                    'channelId': notification!.android!.channelId,
                    'clickAction': notification!.android!.clickAction,
                    'color': notification!.android!.color,
                    'count': notification!.android!.count,
                    'imageUrl': notification!.android!.imageUrl,
                    'link': notification!.android!.link,
                    'priority': _getPriority(),
                    'smallIcon': notification!.android!.smallIcon,
                    'sound': notification!.android!.sound,
                    'ticker': notification!.android!.ticker,
                    'visibility': _getAndroidVisibility(),
                  },
            'apple': notification?.apple == null
                ? null
                : {
                    'badge': notification!.apple!.badge,
                    'subtitle': notification!.apple!.subtitle,
                    'subtitleLocArgs':
                        notification!.apple!.subtitleLocArgs.isNotEmpty
                            ? notification!.apple!.subtitleLocArgs
                            : null,
                    'subtitleLocKey': notification!.apple!.subtitleLocKey,
                    'sound': notification!.apple!.sound == null
                        ? null
                        : {
                            'critical': notification!.apple!.sound?.critical,
                            'name': notification!.apple!.sound?.name,
                            'volume': notification!.apple!.sound?.volume,
                          }
                  },
          },
    'sentTime': sentTime?.millisecondsSinceEpoch,
    'threadId': threadId,
    'ttl': ttl,
  };
}