Local notifications on all 6 platforms: show, schedule (Gregorian or Jalali repeats), buttons, replies, progress, badges, channels. Needs dart run u:app permission add notifications. UNotification.show(1, title: "Done")
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- 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
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Properties
-
events
→ Stream<
UNotificationEvent> -
Taps, button presses, replies and dismissals, including the tap that launched the app.
UNotification.events.listen(handle)no setter
Static Methods
-
active(
) → Future< List< UNotificationInfo> > - Notifications currently in the notification centre (web: those shown by this tab).
-
after(
Duration delay, UNotificationRequest request) → Future< bool> -
Shows a notification after
delay.UNotification.after(30.minutes, req) -
cancel(
int id) → Future< void> -
Removes a shown or scheduled notification.
UNotification.cancel(1) -
cancelAll(
) → Future< void> - Removes every shown and scheduled notification.
-
cancelGroup(
String group) → Future< void> -
Removes every shown notification in
group.UNotification.cancelGroup("chat_42") -
channels(
) → Future< List< String> > - Android only: ids of the app's channels (empty elsewhere).
-
clearBadge(
) → Future< bool> - Clears the app-icon badge.
-
createChannel(
UNotificationChannel channel) → Future< void> -
Android only: creates a channel with its own sound, vibration and importance (users can mute each).
UNotification.createChannel(const UNotificationChannel(id: "orders", name: "Orders")) -
createChannelGroup(
String id, String name) → Future< void> - Android only: a heading that groups channels in the app's notification settings.
-
daily(
UNotificationRequest request, {required int hour, int minute = 0}) → Future< bool> -
Every day at
hour:minute.UNotification.daily(req, hour: 9) -
deleteChannel(
String id) → Future< void> - Android only: deletes a channel.
-
init(
{String? androidIcon, String? windowsIconPath, bool showInForeground = true}) → Future< void> -
Sets up notifications; initU() already calls it.
androidIconis a drawable name (default: the app icon).UNotification.init(androidIcon: "ic_notification") -
isAllowed(
) → Future< bool> -
True when notifications can be shown.
if (!await UNotification.isAllowed()) UNotification.openSettings() -
launchEvent(
) → Future< UNotificationEvent?> -
The tap that opened the app, or null when it was opened normally.
final e = await UNotification.launchEvent(); -
listen(
void onEvent(UNotificationEvent event)) → StreamSubscription< UNotificationEvent> -
Calls
onEventfor every tap, button, reply and dismissal.UNotification.listen((e) => UNavigator.push(OrderPage(e.payload))) -
monthlyJalali(
UNotificationRequest request, {required int day, required int hour, int minute = 0}) → Future< bool> -
Every Jalali month on
dayathour:minute; short months fall back to their last day.UNotification.monthlyJalali(req, day: 1, hour: 9) -
openSettings(
) → Future< bool> - Opens this app's notification settings (web: false).
-
pending(
) → Future< List< UNotificationInfo> > -
Scheduled notifications that have not fired yet.
(await UNotification.pending()).length -
permission(
) → Future< UNotificationPermission> - Current permission, plus exact-alarm and full-screen access on Android.
-
progress(
int id, {required String title, required int value, int max = 100, String? body, bool indeterminate = false}) → Future< bool> -
Shows or updates a progress notification (Android, Windows, Linux bar; others show the percent in text).
UNotification.progress(5, title: "Downloading", value: 40) -
requestExactAlarms(
) → Future< bool> -
Android 12+: opens "Alarms & reminders" so schedules fire to the minute; true elsewhere. Needs
permission add alarm. -
requestPermission(
{bool provisional = false, bool critical = false}) → Future< UNotificationPermission> -
Asks for permission (Android 13+, Apple, web);
provisionaldelivers quietly on iOS without asking.await UNotification.requestPermission() -
schedule(
UNotificationRequest request, DateTime at, {URepeat repeat = URepeat.none, URepeatCalendar calendar = URepeatCalendar.gregorian, bool exact = true}) → Future< bool> -
Shows
requestatat, optionally repeating; monthly/yearly followcalendar(Jalali supported). Exact time on Android:permission add alarm.UNotification.schedule(req, DateTime.now().add(1.hours)) -
setBadge(
int count) → Future< bool> -
Sets the app-icon badge number, 0 clears it (iOS, macOS, Windows, Linux Unity launchers, installed PWAs, some Android launchers).
UNotification.setBadge(3) -
show(
int id, {String? title, String? body, Map< String, Object?> ? payload, String? image, List<UNotificationAction> actions = const <UNotificationAction>[]}) → Future<bool> -
Shows a notification now; the same
idreplaces the old one. Web: only while the tab is open.UNotification.show(1, title: "Order shipped", body: "Arrives tomorrow") -
showRequest(
UNotificationRequest request) → Future< bool> -
Shows a notification with every option (big picture, buttons, reply, channel, group, sound, full screen…).
UNotification.showRequest(UNotificationRequest(id: 2, title: "Hi", actions: [...])) -
weekly(
UNotificationRequest request, {required int weekday, required int hour, int minute = 0}) → Future< bool> -
Every week on
weekday(DateTime.monday…sunday) athour:minute.UNotification.weekly(req, weekday: DateTime.saturday, hour: 10)