PushServiceHandler class

Handler de notificações e mensagens in-app.

O pacote não depende diretamente do firebase_messaging para manter a instalação leve. Integra-se assim:

final handler = PushServiceHandler();

handler.onOpened = (notification) {
  // navegar para o ecrã certo
};

// No main(), antes de runApp:
FirebaseMessaging.onMessage.listen((message) {
  handler.notifyReceived(PushNotification.fromMap(message.data));
});
FirebaseMessaging.onMessageOpenedApp.listen((message) {
  handler.notifyOpened(PushNotification.fromMap(message.data));
});
FirebaseMessaging.instance.getInitialMessage().then((message) {
  if (message != null) handler.notifyOpened(PushNotification.fromMap(message.data));
});

Constructors

PushServiceHandler()

Properties

hashCode → int
The hash code for this object.
no setterinherited
onInAppMessage ↔ OnInAppMessage?
getter/setter pair
onInAppMessageAction ↔ OnInAppMessageAction?
getter/setter pair
onOpened ↔ OnPushOpened?
getter/setter pair
onReceived ↔ OnPushOpened?
getter/setter pair
onTokenRefreshed ↔ OnTokenRefreshed?
getter/setter pair
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
notifyInAppMessage(PushInAppMessage message) → void
notifyInAppMessageAction(PushInAppMessage message, InAppButton button) → void
notifyOpened(PushNotification notification) → void
notifyReceived(PushNotification notification) → void
notifyTokenRefreshed(String token) → void
toString() → String
A string representation of this object.
inherited

Operators

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