NotificationPayload class
Represents the complete payload of a notification.
This class encapsulates all information needed to display and handle a notification, including content, routing, actions, and rich media.
- Annotations
-
- @JsonSerializable.new(explicitToJson: true)
Constructors
-
NotificationPayload({String? title, String? body, String? imageUrl, String? route, Map<
String, dynamic> data = const {}, List<NotificationAction> actions = const [], int? id, String? channelId, String? category, String? sound, int? badge, int? ttl, String? priority}) -
const
-
NotificationPayload.fromJson(Map<
String, dynamic> json) -
Creates a NotificationPayload from JSON data.
factory
- NotificationPayload.fromRemoteMessage(RemoteMessage message)
-
Creates a NotificationPayload from a Firebase Cloud Messaging
RemoteMessage.factory
Properties
-
actions
→ List<
NotificationAction> -
List of action buttons to display with the notification.
final
- badge → int?
-
Badge count to display on app icon (iOS/Android).
final
- body → String?
-
Notification body text.
final
- category → String?
-
Notification category (iOS only).
final
- channelId → String?
-
Notification channel ID (Android only).
final
-
data
→ Map<
String, dynamic> -
Additional data associated with the notification.
final
- hashCode → int
-
The hash code for this object.
no setteroverride
- id → int?
-
Unique identifier for this notification.
final
- imageUrl → String?
-
URL to an image to display in the notification.
final
- priority → String?
-
Priority of the notification.
final
- route → String?
-
Route or screen to navigate to when notification is tapped.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- sound → String?
-
Sound to play when notification is received.
final
- title → String?
-
Notification title.
final
- ttl → int?
-
Time-to-live for the notification in seconds.
final
Methods
-
copyWith(
{String? title, String? body, String? imageUrl, String? route, Map< String, dynamic> ? data, List<NotificationAction> ? actions, int? id, String? channelId, String? category, String? sound, int? badge, int? ttl, String? priority}) → NotificationPayload - Creates a copy of this payload with the given fields replaced.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toJson(
) → Map< String, dynamic> - Converts this NotificationPayload to JSON data.
-
toString(
) → String -
A string representation of this object.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
override