DwPushData class final
What a notification carries for the app besides its text: a typed payload and a link — the in-app path a tap opens.
The server writes it into the provider's data map with toWire, the app reads it back with fromWire. Both call this class, so the keys exist once (the lesson of #85: wire keys held on two sides by string tests that could pass while the sides disagreed). The web service worker, which runs outside Dart, is checked against linkKey by a test that executes it.
A provider's data map holds strings only; the payload travels as its wire name and its JSON, and is decoded by the protocol the app speaks — a project's data object, never a map of hand-picked keys.
Constructors
- DwPushData({DwDataObject? payload, String? link})
-
const
Properties
- hashCode → int
-
The hash code for this object.
no setteroverride
- isEmpty → bool
-
no setter
- link → String?
-
The in-app path a tap opens (
/news/12): what the web service worker navigates to, and what the app routes by when it has no payload.final - payload → DwDataObject?
-
The data object the app receives, registered in the protocol.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
override
-
toWire(
) → Map< String, String> - The provider data map: only the keys that have a value.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
override
Static Methods
-
fromWire(
Map< Object?, Object?> data, DwWireProtocol protocol) → DwPushData -
Reads a provider data map (other keys are ignored). Throws
FormatException when the payload keys are present but not a payload
protocolknows — an app older than the server that sent it, or a message that is not ours.
Constants
- bodyKey → const String
- imageKey → const String
- linkKey → const String
- The data key of link.
- payloadKey → const String
- The data key of the payload's JSON.
- titleKey → const String
-
Keys of a notification drawn by the app itself, for a transport that
cannot show one with a picture: RuStore ignores an image in its
notification block, so such a message travels as data only and
dartway_push_rustoredraws it on the device from these. - typeKey → const String
- The data key of the payload's wire name.