InvergeDocs
FlutterAPI reference

Push notifications

Push notifications in the Flutter SDK.

import 'package:nexus_flutter/nexus.dart';
SymbolKindSummary
PushPlatformenumThe device platform a push token belongs to.
PushProviderenumThe delivery provider a push token targets.
NexusPushclassNexus Push.

PushPlatform

enum
enum PushPlatform

The device platform a push token belongs to.

ValueDescription
PushPlatform.ios
PushPlatform.android
PushPlatform.web
View source

PushProvider

enum
enum PushProvider

The delivery provider a push token targets.

ValueDescription
PushProvider.fcm
PushProvider.apns
PushProvider.webpush
View source

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).

View source

token

property
String? get token

The last token registered this launch.

View source

language

property
String? get language

The language notifications are localized to for this device (or null).

View source

tags

property
Map<String, String> get tags

The subscriber tags currently set on this device.

View source

onOpened

field
void Function(NexusPushOpen open)? onOpened

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.

View source

setLanguage()

method
Future<void> setLanguage(String lang)

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.

Safe to call before or after push is enabled — if a token is already registered it re-registers immediately; otherwise the language is applied on the next registration.

Parameters

Prop

Type

View source

setTag()

method
Future<void> setTag(String key, String value)

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 …).

Safe before or after push is enabled: if a token is already registered the tags sync immediately, otherwise they're attached on the next registration.

Parameters

Prop

Type

View source

setTags()

method
Future<void> setTags(Map<String, String> tags)

Set several tags at once (merged into the existing tags).

Parameters

Prop

Type

View source

removeTag()

method
Future<void> removeTag(String key)

Remove a previously set tag.

Parameters

Prop

Type

View source

clearTags()

method
Future<void> clearTags()

Clear all tags from this subscriber.

View source

start()

method
Future<void> start()

Turn-key enable: permission → token → register → refresh + open handlers. Called automatically when pushEnabled is set. Safe to call again; every failure is caught and logged so push can never break the app.

View source

registerToken()

method
Future<void> registerToken(String token, {required PushPlatform platform, PushProvider? provider, String? lang})

Register (or refresh) this device's push token, correlated to the journey identity. Call this yourself only for BYO-token setups; pushEnabled does it automatically.

Parameters

Prop

Type

View source

unregister()

method
Future<void> unregister([String? token])

Stop delivering to a token (call on logout/uninstall). Defaults to the last registered token.

Parameters

Prop

Type

View source

reportOpen()

method
Future<void> reportOpen(Map<String, dynamic> data)

Report a notification open. Reads nexus_campaign_id from the payload (Nexus stamps it on every campaign push) to power open-rate + A/B outcomes. With pushEnabled this is wired for you; call it manually only for BYO setups.

Parameters

Prop

Type

View source

dispose()

method
Future<void> dispose()

Cancel the refresh/open/foreground listeners (called on Nexus dispose / re-init).

View source

On this page