toJson method

Map<String, dynamic> toJson()

Implementation

Map<String, dynamic> toJson() {
  final apsMap = {
    if (alertDetails != null) 'alert': alertDetails?.toJson() else 'alert': alert,
    'badge': badge,
    'sound': sound,
    'category': category,
    'thread-id': threadId,
    'content-available': contentAvailable == true ? 1 : null,
    'mutable-content': mutableContent == true ? 1 : null,
  }..removeWhere((k, v) => v == null);

  return {
    ...apsMap,
    ...?customData, // Includes any extra fields
  };
}