NexusPush class
Nexus Push. With pushEnabled: true this is fully turn-key — start runs at
init and handles permission, token acquisition, registration, refresh and
open-tracking for you. The manual methods (registerToken/reportOpen) stay
available for BYO-token setups (e.g. raw APNs or your own messaging plugin).
Constructors
- NexusPush(NexusHttp _http, NexusIdentity _id, NexusConfig _cfg)
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- language → String?
-
The language notifications are localized to for this device (or null).
no setter
- onOpened ↔ void Function(NexusPushOpen open)?
-
Called when a notification (or one of its action buttons) is opened. Set
this to route the user, or to handle an action button's
actionUrl.getter/setter pair - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
The subscriber tags currently set on this device.
no setter
- token → String?
-
The last token registered this launch.
no setter
Methods
-
clearTags(
) → Future< void> - Clear all tags from this subscriber.
-
dispose(
) → Future< void> - Cancel the refresh/open/foreground listeners (called on Nexus dispose / re-init).
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
registerToken(
String token, {required PushPlatform platform, PushProvider? provider, String? lang}) → Future< void> -
Register (or refresh) this device's push token, correlated to the journey
identity. Call this yourself only for BYO-token setups;
pushEnableddoes it automatically. -
removeTag(
String key) → Future< void> - Remove a previously set tag.
-
reportOpen(
Map< String, dynamic> data) → Future<void> -
Report a notification open. Reads
nexus_campaign_idfrom the payload (Nexus stamps it on every campaign push) to power open-rate + A/B outcomes. WithpushEnabledthis is wired for you; call it manually only for BYO setups. -
setLanguage(
String lang) → Future< void> -
Set the user's app language so campaigns are delivered localized to it
(e.g.
setLanguage('en')/setLanguage('ar')). Call it at startup with the app's current locale, and again whenever the user changes it. The code is attached to the device token; a campaign with content for that language is sent in it, otherwise the campaign's default language is used. -
setTag(
String key, String value) → Future< void> -
Tag this subscriber with a key/value so you can target them in segments —
e.g.
setTag('role', 'client'),setTag('username', 'ehs4nnn'). Build tag-condition segments in the console (Push → Segments → Tag is …). -
setTags(
Map< String, String> tags) → Future<void> - Set several tags at once (merged into the existing tags).
-
start(
) → Future< void> -
Turn-key enable: permission → token → register → refresh + open handlers.
Called automatically when
pushEnabledis set. Safe to call again; every failure is caught and logged so push can never break the app. -
toString(
) → String -
A string representation of this object.
inherited
-
unregister(
[String? token]) → Future< void> - Stop delivering to a token (call on logout/uninstall). Defaults to the last registered token.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited