RemoteNotification class

Class for handling FirebaseMessaging.

First, monitor notifications with listen. Notifications can be received after this method is executed.

You can subscribe and unsubscribe to topics by clicking subscribe and unsubscribe.

Notifications can be sent using send. (Assuming that a Function for notification has been set up in FirebaseFunctions. It is also possible to set FunctionsAdapter in RemoteNotificationMasamuneAdapter.functionsAdapter).

When a notification is retrieved, value is updated and notifyListeners is called.

By monitoring the status with addListener, it is possible to do something when a notification comes in.

Various settings can be overridden by passing adapter. If this is not used, RemoteNotificationMasamuneAdapter.primary is used.

FirebaseMessagingを取り扱うためのクラス。

まずlistenで通知の監視を行います。このメソッド実行後から通知の受け取りが可能になります。

subscribeunsubscribeでトピックの購読、購読解除が行なえます。

sendで通知の送信が可能です。(FirebaseFunctionsで通知用のFunctionが設定されていること前提。RemoteNotificationMasamuneAdapter.functionsAdapterFunctionsAdapterを設定することも可能です。)

通知を取得した場合、valueが更新され、notifyListenersが呼ばれます。

addListenerで状態を監視することで通知が来たときになにかしらの処理を行うことが可能です。

adapterを渡すことで各種設定を上書きすることができます。これが利用されない場合はRemoteNotificationMasamuneAdapter.primaryが利用されます。

Inheritance

Constructors

RemoteNotification({RemoteNotificationMasamuneAdapter? adapter})
Class for handling FirebaseMessaging.

Properties

adapter RemoteNotificationMasamuneAdapter
TAdapter to be used.
no setterinherited
hashCode int
The hash code for this object.
no setterinherited
hasListeners bool
Whether any listeners are currently registered.
no setterinherited
listening bool
Returns true if notification receipt has been initiated.
no setter
Callback when the URL is launched.
no setter
primaryAdapter RemoteNotificationMasamuneAdapter
Specifies the default TAdapter if adapter is Null.
no setteroverride
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
value NotificationValue?
The content of the most recent notice received.
no setteroverride

Methods

addListener(VoidCallback listener) → void
Register a closure to be called when the object changes.
inherited
addSchedule({required DateTime time, required String title, required String text, required NotificationTargetQuery target, String? channel, DynamicMap? data, int? badgeCount, NotificationSound sound = NotificationSound.defaultSound, Uri? link, String? databaseId}) Future<void>
Register notifications in the database for scaling.
dispose() → void
Discards any resources used by the object. After this is called, the object is not in a usable state and should be discarded (calls to addListener will throw after the object is disposed).
override
getToken({bool reload = false, FutureOr<void> onRetrievedToken(String token)?}) Future<String?>
Obtain the FCM token for this terminal.
listen({FutureOr<void> onLink(Uri? link, bool onOpenedApp)?, FutureOr<void> onRetrievedToken(String token)?}) Future<void>
Start receiving notifications.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
notifyListeners() → void
Call all the registered listeners.
inherited
removeListener(VoidCallback listener) → void
Remove a previously registered closure from the list of closures that are notified when the object changes.
inherited
removeSchedule({required DateTime time, required NotificationTargetQuery target, String? databaseId}) Future<void>
Delete a notification schedule that has already been registered.
send({required String title, required String text, required NotificationTargetQuery target, String? channel, DynamicMap? data, int? badgeCount, NotificationSound sound = NotificationSound.defaultSound, Uri? link}) Future<SendRemoteNotificationFunctionsActionResponse>
Start the Functions for sending FCM notifications deployed in FirebaseFunctions.
setValueInternal(NotificationValue? value) → void
Set method is used to update the current state.
inherited
subscribe(String topic) Future<void>
Subscribe to a topic named topic.
toString() String
A string representation of this object.
inherited
unsubscribe(String topic) Future<void>
Unsubscribe from a topic name named topic.

Operators

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

Constants

query → const _$RemoteNotificationQuery
Query for Picker.
schedule → const _$RemoteNotificationSchedule
Model for Schedule.