NotificationManager class abstract
Manages user notifications, including creating, scheduling, and canceling notifications.
This manager serves two purposes:
-
It is used by the AppTaskController to create notification about UserTasks (which are created based on AppTask in the
StudyProtocol). This happens automatically, if the app task is configured to send a notification. -
It can be used by the app to create, schedule, and cancel app-specific notifications. This is done using the createNotification, scheduleNotification, and scheduleRecurrentNotifications methods, which creates an immediate, scheduled, or recurrent notification, respectively.
The SmartPhoneClientManager uses FlutterLocalNotificationManager, available as SmartPhoneClientManager.notificationManager.
- Implementers
Constructors
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
-
notificationTaps
→ Stream<
String> -
The payloads of tapped notifications created with createNotification.
Taps on task notifications are handled by the AppTaskController.
no setter
-
pendingNotificationRequestsCount
→ Future<
int> -
The number of pending notifications.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
cancelNotification(
int id) → Future< void> -
Cancels (i.e., removes) the notification with
id. -
cancelTaskNotification(
UserTask task) → Future< void> -
Cancels (i.e., removes) the notification for the
task. -
configure(
) → Future< void> - Configures and sets up the notification manager.
-
createNotification(
{int? id, required String title, String? body, String? payload}) → Future< int> -
Creates an immediate notification with
id,title, andbody. If theidis not specified, a random id will be generated. When tapped,payloadis emitted on notificationTaps. -
createTaskNotification(
UserTask task) → Future< void> -
Creates an immediate notification for a
task. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
scheduleNotification(
{int? id, required String title, String? body, required DateTime schedule}) → Future< int> -
Schedules a notification with
id,title, andbodyat thescheduletime. If theidis not specified, a random id will be generated. -
scheduleRecurrentNotifications(
{int? id, required String title, String? body, required RecurrentScheduledTrigger schedule}) → Future< int> -
Schedules recurrent notifications with
id,title, andbodyat thescheduletime. -
scheduleTaskNotification(
UserTask task) → Future< void> -
Schedules a notification for a
taskat its UserTask.triggerTime. -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Properties
- pendingNotificationLimit → int
-
The maximum number of pending scheduled notifications: 64 on iOS and
500 on Android.
final
Constants
- CHANNEL_DESCRIPTION → const String
- The description of the notification channel as shown in the Settings on Android phones.
- CHANNEL_ID → const String
- The id of the notification channel for immediate notifications.
- CHANNEL_NAME → const String
- The name of the notification channel as shown in the Settings on Android phones.
- SCHEDULED_CHANNEL_DESCRIPTION → const String
- The description of the notification channel as shown in the Settings on Android phones.
- SCHEDULED_CHANNEL_ID → const String
- The id of the notification channel for scheduled notifications.
- SCHEDULED_CHANNEL_NAME → const String
- The name of the notification channel as shown in the Settings on Android phones.