long_time_no_notification

Last updated:

0 purchases

long_time_no_notification Image
long_time_no_notification Images
Add to Cart

Description:

long time no notification

long_time_no_notification #
A package for easy management of showing and hiding notifications once closed!
Motivation #
We wanted to be able to easily manage showing and hiding notifications on the client side only.
For example, suppose the following notification is displayed in the application.

As a functional requirement, the notification should not be displayed once the user closes it, either forever or for 7 days.
Also, the WebAPI does not return whether the notification should be shown or not.
In such a case, long_time_no_notification is useful.
Usage #
// not Display forever once closed
LongTimeNoNotification.setForever(id: 'id_1');

// not show up until 7 days have passed
LongTimeNoNotification.setDuration(id: 'id_2', duration: const Duration(days: 7);

// not show up until May 30, 2022
LongTimeNoNotification.setNext(id: 'id_2', nextDisplayAt: DateTime(2022, 5, 30);

// find data by id
final notification = await LongTimeNoNotification.findBy('id_3');

// should it be displayed or not
notification.shouldNotify();

// datetime to be displayed next
notification.nextDisplayAt;

// datetime last displayed
notification.lastDisplayAt;
copied to clipboard
Notes #

Do not duplicate IDs.
IDs for notifications are stored in SharedPreferences, so please do not pass secure strings as IDs.

License:

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product:

Customer Reviews

There are no reviews.