OSNotification class

A class representing the notification, including the payload of the notification as well as additional parameters (such as whether the notification was shown to the user, whether it's silent, etc.)

Available Extensions

Constructors

OSNotification(Map<String, dynamic> json)

Properties

additionalData Map<String, dynamic>?
Any additional custom data you want to send along with this notification.
getter/setter pair
androidNotificationId int?
(Android Only) The android notification ID (not same as the OneSignal notification ID)
getter/setter pair
attachments Map<String, dynamic>?
(iOS Only) Any attachments (images, sounds, videos) you want to display with this notification.
getter/setter pair
backgroundImageLayout OSAndroidBackgroundImageLayout?
(Android Only) Describes the background image layout of the notification (if set)
getter/setter pair
badge int?
(iOS Only) If you set the badge to a specific value, this integer property will be that value
getter/setter pair
badgeIncrement int?
(iOS Only) If you want to increment the badge by some value, this integer will be the increment/decrement
getter/setter pair
bigPicture String?
(Android Only) The URL or filename for the image to use as the big picture for the notification
getter/setter pair
body String?
The body (should contain most of the text)
getter/setter pair
buttons List<OSActionButton>?
Any buttons you want to add to the notification.
getter/setter pair
category String?
(iOS Only) The category for this notification. This can trigger custom behavior (ie. if this notification should display a custom Content Extension for custom UI)
getter/setter pair
collapseId String?
(Android Only) The collapse ID for the notification As opposed to groupKey (which causes stacking), the collapse ID will completely replace any previously received push notifications that use the same collapse_id
getter/setter pair
contentAvailable bool?
(iOS Only) Tells the system to launch your app in the background (ie. if content is available to download in the background)
getter/setter pair
fromProjectNumber String?
(Android Only) Tells you what project number/sender ID the notification was sent from
getter/setter pair
groupedNotifications List<OSNotification>?
(Android Only) Summary notifications grouped Notification payload will have the most recent notification received.
getter/setter pair
groupKey String?
(Android only) All notifications with the same group key from the same app will be grouped together
getter/setter pair
groupMessage String?
(Android only) Android 6 and earlier only The message to display when multiple notifications have been stacked together. Note: Android 7 allows groups (stacks) to be expanded, so group message is no longer necessary
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
interruptionLevel String?
(iOS Only) The interruption level for the notification. This controls how the notification will be displayed to the user if they are using focus modes or notification summaries
getter/setter pair
largeIcon String?
(Android Only) The filename for the image to use as the large icon for the notification
getter/setter pair
launchUrl String?
If set, he launch URL will be opened when the user taps on your push notification. You can control whether or not it opens in an in-app webview or in Safari (with iOS).
getter/setter pair
ledColor String?
(Android Only) The color to use to light up the LED (if applicable) when the notification is received Given in hex ARGB format.
getter/setter pair
lockScreenVisibility int?
(Android only) API level 21+ Sets the visibility of the notification 1 = Public (default) 0 = Private (hidden from lock screen if user set 'Hide Sensitive content') -1 = Secret (doesn't appear at all)
getter/setter pair
mutableContent bool?
(iOS Only) Tells the system to launch the Notification Extension Service
getter/setter pair
notificationId String
The OneSignal notification ID for this notification
getter/setter pair
priority int?
(Android Only) The priority used with GCM/FCM to describe how urgent the notification is. A higher priority means the notification will be delivered faster. Default = 10.
getter/setter pair
rawPayload Map<String, dynamic>?
A hashmap object representing the raw key/value properties of the push notification
getter/setter pair
relevanceScore double?
(iOS Only) value between 0 and 1 for sorting notifications in a notification summary
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
smallIcon String?
(Android Only) The filename of the image to use as the small icon for the notification
getter/setter pair
smallIconAccentColor String?
(Android Only) The accent color to use on the notification Hex value in ARGB format (it's a normal hex color value, but it includes the alpha channel in addition to red, green, blue)
getter/setter pair
sound String?
The sound file (ie. ping.aiff) that should be played when the notification is received
getter/setter pair
subtitle String?
(iOS Only) The subtitle of the notification
getter/setter pair
templateId String?
If this notification was created from a Template on the OneSignal dashboard, this will be the ID of that template
getter/setter pair
templateName String?
The name of the template (if any) that was used to create this push notification
getter/setter pair
title String?
The title for the notification
getter/setter pair

Methods

convertToJsonString(Map<String, dynamic>? object) String
inherited
jsonRepresentation() String
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited