awesome_notifications 1.0.0-dev.11
awesome_notifications: ^1.0.0-dev.11 copied to clipboard
A complete solution to create Local and Push Notifications, customizing buttons, images, sounds, emoticons and applying many different layouts for Flutter apps.
Awesome Notifications for Flutter #

Engage your users with custom local and push notifications on Flutter, on Android, iOS, macOS, Windows, Linux and the Web. Get real-time events and never miss a user interaction with Awesome Notifications.

*The example app (center), a big picture notification on the iOS lock screen (left) and the
Key Features: #
- Create custom notifications: images, sounds, emojis, action buttons, typed replies and many different layouts, created locally or received by push.
- Real-time events: your Dart code receives every notification created, displayed, dismissed or tapped.
- Six platforms, one code base: Android, iOS, macOS, Windows, Linux and the Web.
- Only what you use: a small core, and one add-on package per feature: schedules, translations, chat, media, calls, live activities and push.
- Trusted performance: receive notifications with confidence in any application lifecycle.
- Easy to use: start creating custom notifications in minutes.
Android notification examples:
iOS notification examples:

Notification Types Available #
- Basic notification
- Big picture notification
- Big text notification
- Inbox notification
- Messaging and messaging group notifications
- Media player notifications
- Notifications with action buttons and typed replies
- Grouped notifications
- Progress bar notifications (Android)
- Call, live activity and foreground service notifications (with their add-on packages)
All notification types can be created locally or received by push, with all the features and customizations available.
๐ค Contributing #
Contributions are welcome! Please read our Contributing Guide before submitting a pull request.
Important: All pull requests must target the development branch. PRs aimed at master will be rejected.
๐ฌ Discord Chat Server #
Stay up to date with new updates and get community support by subscribing to our Discord chat server:
๐ฐ Donate via Stripe or BuyMeACoffee #
Help us improve and maintain our work with donations of any amount via Stripe or BuyMeACoffee. Your donation will mainly be used to purchase new devices and equipment, which we will use to test and ensure that our plugins work correctly on all platforms and their respective versions.
๐ Table of Contents #
- ๐ถ Main Philosophy of Awesome Notifications
- ๐ฑ Platform support
- ๐ Incompatible plugins
- ๐ Getting Started
- ๐ Your First Notification
- ๐ Migrating from 0.12.1
- ๐ท Awesome Notification's Flowchart
- โก๏ธ Notification Events
- ๐ Notification Action Types
- ๐ฆ Notification's Category
- ๐ฎโโ๏ธ Requesting Permissions
- ๐ก Notification channels
- ๐ด App Badge
- โฑ Chronometer and Timeout (Expiration)
- โ๏ธ Progress Bar Notifications
- ๐ Emojis (Emoticons)
- ๐จ Notification Layout Types
- ๐ท Media Source Types
- โฌ๏ธ Notification Importance
- ๐ Wake Up Screen Notifications
- ๐ฅ Full Screen Notifications (Android)
- ๐ Managing Notifications
- ๐ Notification Structures
- ๐ฑ Example Apps
- ๐ฉบ Common Known Issues
- โ Next steps
๐ถ Main Philosophy of Awesome Notifications #
We make notifications straightforward and feature-rich, so you focus on the content, not on what each device can do. Every feature a device has is used, and the ones it lacks are simply left out.
- Same call, same effect: your code behaves the same on every platform, as far as each one allows.
- Consistent delivery: events that happen while your app isn't listening are kept and delivered as soon as the listeners are set.
- Device-specific adaptation: features a device doesn't have (an LED light, a full screen intent) are ignored, never an error.
- Notification channels: Android's channels are emulated on every other platform.
- App badge: iOS's badge counter is emulated on every other platform.
- Only what you use: a small core and one package per feature, all showing their notifications through the core.
๐ฑ Platform support #
| Package | Adds | Android | iOS | macOS | Windows | Linux | Web |
|---|---|---|---|---|---|---|---|
awesome_notifications |
The core (this package) | โ | โ | โ | โ | ๐งช | โ |
awesome_notifications_schedules |
Scheduled notifications | โ | โ | โ | โ | ๐งช | โ |
awesome_notifications_localizations |
Translated notifications | โ | โ | โ | โ | ๐งช | โ |
awesome_notifications_chat |
Conversations with people | โ | โ | โ | โ | ๐งช | โ |
awesome_notifications_media |
The system's media controls | โ | โ | โ | โ | ๐งช | โ |
awesome_notifications_calls |
Incoming calls | โ | โ | โ | โ | ๐งช | โ |
awesome_notifications_live_activities |
Live Activities, Live Updates | โ | โ | โ | โ | ๐งช | โ |
awesome_notifications_fcm |
Push: Firebase Cloud Messaging | โ | โ | โ | โ | โ | โ |
awesome_notifications_unifiedpush |
Push: UnifiedPush | ๐งช | โ | โ | โ | ๐งช | โ |
awesome_notifications_wns |
Push: Windows Push Notification Services | โ | โ | โ | โ | โ | โ |
awesome_notifications_onesignal |
Push: OneSignal | โ | โ | โ | โ | โ | โ |
awesome_notifications_braze |
Push: Braze | ๐งช | ๐งช | โ | โ | โ | โ |
awesome_notifications_airship |
Push: Airship | ๐งช | ๐งช | โ | โ | โ | โ |
awesome_notifications_foreground_service |
Foreground services | โ | โ | โ | โ | โ | โ |
โ supported ยท ๐งช preview (implemented, still being validated) ยท โ not available
Minimum versions: Flutter 3.44 (Dart 3.12) ยท Android 7.0 (API 24) ยท iOS 13 ยท macOS 10.15 ยท Windows 10.
๐ Incompatible plugins #
Don't use another notification plugin (such as flutter_local_notifications) together with
Awesome Notifications: both compete for the same system resources, and events get lost. Each
push package lists the plugins it can't be combined with.
๐ Getting Started #
Installation #
dependencies:
awesome_notifications: ^1.0.0-dev.11
Add the add-on packages you use, with the same version. Push packages have their own setup, in their READMEs.
flutter pub get
๐ค Android #
Set the SDK versions in android/app/build.gradle.kts:
android {
compileSdk = 36
defaultConfig {
minSdk = 24
targetSdk = 36
}
}
In android/app/src/main/AndroidManifest.xml, every <activity>, <activity-alias>,
<service> or <receiver> with an <intent-filter> needs android:exported (Android 12 and
later refuse to install the app otherwise):
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<application>
<activity
android:name=".MainActivity"
android:exported="true">
...
</activity>
</application>
</manifest>
The plugin declares the notification permission (POST_NOTIFICATIONS) by itself. The features
that need another permission list it in their own sections.
๐ iOS #
With Swift Package Manager (Flutter's default), nothing to set up. With CocoaPods, point the
app's ios/Podfile to the engine the plugin ships, inside target 'Runner':
target 'Runner' do
use_frameworks!
flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
pod 'IosAwnCore', :path => '.symlinks/plugins/awesome_notifications/ios'
# ...
end
๐ป macOS #
Works as on iOS. With Swift Package Manager, nothing to set up. With CocoaPods, in
macos/Podfile, inside target 'Runner':
target 'Runner' do
use_frameworks!
flutter_install_all_macos_pods File.dirname(File.realpath(__FILE__))
pod 'IosAwnCore', :path => 'Flutter/ephemeral/.symlinks/plugins/awesome_notifications/ios'
# ...
end
๐ช Windows #
Nothing to set up, even for an app that isn't packaged: the plugin registers the app's
identity by itself. The settings pages (showNotificationConfigPage, showAlarmPage,
showGlobalDndOverridePage) do nothing yet.
๐ง Linux #
Nothing to set up. Notifications go to the desktop's notification server (GNOME, KDE, XFCE, dunst, mako...), which decides what is shown: images, buttons and typed replies appear where the server supports them. Taps, buttons and dismissals reach the app only while it runs, and the settings pages do nothing yet.
๐ Web #
Nothing to set up: the plugin registers its own service worker.
- Serve the app over
https(orlocalhost). Elsewhere, notifications have no buttons and appear only while the page is open. - Browsers show two buttons on most systems, and leave out the ones that need typed text.
- Images: only
https://andasset://. - A tap that opens the app works even with its tab closed.
SilentActionandKeepOnTopbuttons, and dismissals, reach the app only while one of its tabs is open. - To test it, run
flutter run -d web-serverand open the address in your own browser: the Chrome thatflutter run -d chromeopens has notifications disabled.
๐ Your First Notification #
- Import the plugin:
import 'package:awesome_notifications/awesome_notifications.dart';
- Initialize it in
main(), beforerunApp, with at least one channel. The icon is an Android drawable resource (nulluses the app icon):
Future<void> main() async {
WidgetsFlutterBinding.ensureInitialized();
await AwesomeNotifications().initialize(
// null uses the app icon
'resource://drawable/res_app_icon',
[
NotificationChannel(
channelGroupKey: 'basic_channel_group',
channelKey: 'basic_channel',
channelName: 'Basic notifications',
channelDescription: 'Notification channel for basic tests',
defaultColor: const Color(0xFF9D50DD),
ledColor: Colors.white,
),
],
// Channel groups are only visual and are not required
channelGroups: [
NotificationChannelGroup(
channelGroupKey: 'basic_channel_group',
channelGroupName: 'Basic group',
),
],
debug: true,
);
runApp(const MyApp());
}
- Create static (or top-level) methods to receive the events. Mark each one with
@pragma('vm:entry-point'): the native side calls them, even with the app closed.
class NotificationController {
/// A new notification or schedule was created
@pragma('vm:entry-point')
static Future<void> onNotificationCreatedMethod(
ReceivedNotification receivedNotification) async {}
/// A notification was displayed
@pragma('vm:entry-point')
static Future<void> onNotificationDisplayedMethod(
ReceivedNotification receivedNotification) async {}
/// The user dismissed a notification
@pragma('vm:entry-point')
static Future<void> onDismissActionReceivedMethod(
ReceivedAction receivedAction) async {}
/// The user tapped a notification or one of its buttons
@pragma('vm:entry-point')
static Future<void> onActionReceivedMethod(
ReceivedAction receivedAction) async {
// Opens the notification page, without stacking it on another one
MyApp.navigatorKey.currentState?.pushNamedAndRemoveUntil(
'/notification-page',
(route) => (route.settings.name != '/notification-page') || route.isFirst,
arguments: receivedAction,
);
}
}
- Set the listeners in your app's first
initState. The events are delivered only aftersetListeners; the ones that happened before are kept until then. A global navigator key lets the static methods navigate:
class MyApp extends StatefulWidget {
const MyApp({super.key});
static final navigatorKey = GlobalKey<NavigatorState>();
@override
State<MyApp> createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
@override
void initState() {
AwesomeNotifications().setListeners(
onActionReceivedMethod: NotificationController.onActionReceivedMethod,
onNotificationCreatedMethod:
NotificationController.onNotificationCreatedMethod,
onNotificationDisplayedMethod:
NotificationController.onNotificationDisplayedMethod,
onDismissActionReceivedMethod:
NotificationController.onDismissActionReceivedMethod,
);
super.initState();
}
@override
Widget build(BuildContext context) {
return MaterialApp(
navigatorKey: MyApp.navigatorKey,
initialRoute: '/',
onGenerateRoute: (settings) => switch (settings.name) {
'/notification-page' => MaterialPageRoute(
builder: (context) => NotificationPage(
receivedAction: settings.arguments as ReceivedAction)),
_ => MaterialPageRoute(builder: (context) => const HomePage()),
},
);
}
}
Anonymous functions are not valid listeners: they can't be called from a closed app. To
reach a BuildContext, use the navigator key, as above.
- Ask the user's permission (explain why first, in your own dialog):
final isAllowed = await AwesomeNotifications().isNotificationAllowed();
if (!isAllowed) {
// Show your own dialog first, explaining why, then:
await AwesomeNotifications().requestPermissionToSendNotifications();
}
- Create a notification, anywhere in your app:
await AwesomeNotifications().createNotification(
content: NotificationContent(
id: 10,
channelKey: 'basic_channel',
actionType: ActionType.Default,
title: 'Hello World!',
body: 'This is my first notification!',
),
);
This creates a notification with the id 10, on the basic_channel channel, that brings the
app to the foreground when tapped.
๐๐๐ THAT'S IT! CONGRATZ MY FRIEND!!! ๐๐๐
๐ Important notes #
-
Initialize every Awesome Notifications package at each start, even if the app has no permission to show notifications.
-
To know, before
setListeners, whether a notification tap started the app, callgetInitialNotificationAction. It answers the action that started the app, ornull. It doesn't remove the action fromonActionReceivedMethod, unlessremoveFromActionEventsistrue.
Future<void> main() async {
WidgetsFlutterBinding.ensureInitialized();
await AwesomeNotifications().initialize(null, [/* your channels */]);
final receivedAction = await AwesomeNotifications()
.getInitialNotificationAction(removeFromActionEvents: false);
runApp(MyApp(
initialPage: receivedAction?.channelKey == 'call_channel' ? '/call' : '/'));
}
- A
SilentBackgroundActionruns in a separate Dart isolate, without aBuildContext. To act on the main isolate (navigate, update the UI), send the action through aSendPort:
class NotificationController {
static ReceivePort? _receivePort;
/// Call it once, on the main isolate, when the app starts
static void startListeningOnMainIsolate() {
_receivePort = ReceivePort('Notification action port in main isolate')
..listen((data) => _handleAction(ReceivedAction().fromMap(data)));
IsolateNameServer.registerPortWithName(
_receivePort!.sendPort, 'notification_actions');
}
@pragma('vm:entry-point')
static Future<void> onActionReceivedMethod(ReceivedAction received) async {
if (_receivePort == null) {
// A background isolate: forward the action to the main one, if it runs
final sendPort =
IsolateNameServer.lookupPortByName('notification_actions');
if (sendPort != null) {
sendPort.send(received.toMap());
return;
}
}
await _handleAction(received);
}
static Future<void> _handleAction(ReceivedAction received) async {
// Your code
}
}
- On Android, when the user leaves the app with the back button and reopens it from the recent apps, Android repeats the intent that started it. If a notification started the app, its action is delivered again: handle that case in your app if it matters.
๐ Migrating from 0.12.1 #
1.0.0 splits the plugin into a small core and add-on packages. Your notifications, channels, listeners and permissions keep the same code; what changes is the package of some features:
| In 0.12.1 | In 1.0.0 |
|---|---|
createNotification(schedule: NotificationCalendar(...)) |
add awesome_notifications_schedules and pass the schedule in extensions: [NotificationCalendar(...)] |
AwesomeNotifications().listScheduledNotifications(), cancelSchedule, cancelSchedulesByChannelKey, cancelSchedulesByGroupKey, cancelAllSchedules, getNextDate |
the same methods on AwesomeNotificationsSchedules() |
NotificationAndroidCrontab |
not available yet |
createNotification(localizations: {...}) |
add awesome_notifications_localizations and pass extensions: [NotificationLocalizations({...})] |
AwesomeNotifications().setLocalization / getLocalization |
AwesomeNotificationsLocalizations().setLocalization / getLocalization |
import 'package:awesome_notifications/android_foreground_service.dart' |
add awesome_notifications_foreground_service and import it |
The iOS Podfile modifications (AwesomePodFile) |
remove them. With CocoaPods, add the IosAwnCore line instead (see iOS) |
SwiftAwesomeNotificationsPlugin.setPluginRegistrantCallback in AppDelegate.swift |
remove it |
minSdkVersion 23 |
minSdk = 24 |
| Flutter 2.5 or later | Flutter 3.44 or later |
Two defaults changed:
requestPermissionToSendNotificationsno longer opens the app's settings when the user has denied the permission: passopenSettingsWhenDenied: true, or callshowNotificationConfigPage(), to keep that.- Action buttons built from a map (a push, or
createNotificationFromJsonData) ask for typed text only withrequireInputText: true, as the constructor does.
The Messaging, MessagingGroup and MediaPlayer layouts work in the core as they did. The
awesome_notifications_chat and
awesome_notifications_media packages
are optional upgrades of them, with a new model: read their migration sections before adding
them.
๐ท Awesome Notification's Flowchart #
Notifications are created by your Dart code, by an add-on (a schedule) or by a push package, and shown by native code, so they appear immediately or at their scheduled time, whether your app is running or not.

โก๏ธ Notification Events #
The events are delivered only after setListeners, and not always at the moment they happen:
- onNotificationCreatedMethod (optional): a notification was created.
- onNotificationDisplayedMethod (optional): a notification was displayed.
- onActionReceivedMethod (required): the user tapped a notification or one of its buttons.
- onDismissActionReceivedMethod (optional): the user dismissed a notification (some systems don't report every dismissal).
When they are delivered:
| Platform | App in Foreground | App in Background | App Terminated (Force Quit) |
|---|---|---|---|
| Android | Immediately | Immediately | Kept, and delivered when the app starts |
| iOS, macOS | Immediately | Kept, and delivered when the app comes back | Kept, and delivered when the app starts |
Windows and the Web follow Android (Web and Linux have a few limits).
Exception: onActionReceivedMethod is called as soon as the action happens, in any app
state, where the platform can start the app for it.
๐ Notification Action Types #
The actionType of a notification (its body) or of a button:
- Default: brings the app to the foreground.
- SilentAction: doesn't bring the app to the foreground; runs on the main isolate, so it can be interrupted if the app is closed.
- SilentBackgroundAction: doesn't bring the app to the foreground; runs on a separate Dart isolate, with no UI.
- KeepOnTop: runs the action without closing the notification nor bringing the app to the foreground.
- DisabledAction: the notification closes, with no action event.
- DismissAction: dismisses the notification, as the user would, and calls
onDismissActionReceivedMethod. It ignoresautoDismissible. - InputField: deprecated: use
requireInputText: trueon the button instead.
For the silent types, await all your work inside the method: the isolate may end as soon
as the method returns.
๐ฆ Notification's Category #
The category describes the nature of the notification; some systems use it to rank, delay or filter notifications. Always categorize your notifications correctly.
- Alarm: alarm or timer.
- Call: incoming call (voice or video) or similar synchronous communication request.
- Email: asynchronous bulk message (email).
- Error: error in background operation or authentication status.
- Event: calendar event.
- LocalSharing: temporarily sharing location.
- Message: incoming direct message (SMS, instant message, etc.).
- MissedCall: a missed incoming call.
- Navigation: map turn-by-turn navigation.
- Progress: progress of a long-running background operation.
- Promo: promotion or advertisement.
- Recommendation: a specific, timely recommendation for a single thing.
- Reminder: user-scheduled reminder.
- Service: indication of running background service.
- Social: social network or sharing update.
- Status: ongoing information about device or contextual status.
- StopWatch: running stopwatch.
- Transport: media transport control for playback.
- Workout: tracking a user's workout.
๐ฎโโ๏ธ Requesting Permissions #
To show any notification, you need the user's consent, and the user can revoke it at any time. On Android 12 and below, the basic permissions are granted to every newly installed app; on iOS, macOS, Android 13 and later and the Web, even the basic permission must be requested. Linux has no permission an app can read: it is granted whenever a notification server runs.
Disclaimer: On Android, revoking some permissions (the notification permission included) makes the system restart the app. Save the state you need before requesting or changing permissions, and restore it when the app starts again.
Permissions are of three types:
- Normal permissions: not dangerous; no explicit consent needed.
- Execution permissions: more sensitive; the user must consent explicitly.
- Special/Dangerous permissions: may harm the user experience or privacy; the user must consent explicitly, and some platforms also require the manufacturer's (Apple's) approval.
Always check that the permissions you need are granted before creating a notification. To
know which ones need the user's intervention (a settings page instead of a prompt), call
shouldShowRationaleToRequest. Request only what your app needs.
Notification's Permissions: #
- Alert: high-priority notifications that pop up on the screen. Normal-priority ones only show their icon in the status bar.
- Sound: a sound for each new notification, a few seconds long at most.
- Badge: a number or dot over the app icon.
- Light: a blinking LED while the screen is off (only some Android devices have one).
- Vibration: vibrate for each new notification.
- FullScreenIntent: show the notification in full screen, even over another app.
- PreciseAlarms: show scheduled notifications at the exact time. Battery saving modes and some manufacturers may still delay them.
- CriticalAlert: play the sound even in Do Not Disturb / silent mode (see Critical Alerts).
- OverrideDnD: lower the Do Not Disturb level to show critical alerts for Alarm and Call notifications. On iOS it comes with CriticalAlert.
- Provisional: (iOS) show notifications quietly, in Notification Center only, before the user consents.
- Car: show notifications in car mode.
If requestPermissionToSendNotifications gets no permission list, it requests Alert, Badge,
Sound, Vibration and Light.
The method never leaves the app by itself. When the system can't show a dialog for a
permission (the user already denied it, or it is only granted in the settings, as exact alarms),
it answers at once with the permission still missing. Pass openSettingsWhenDenied: true to take
the user to its settings page instead; the method then answers when the user returns to the app.
Notification's Permission Level #
A permission lives on one of three levels:

- Device level: settings that apply to every app (all notifications off, battery saving, Do Not Disturb).
- Application level: settings that apply to every notification of the app.
- Channel level: settings that apply only to the notifications of one channel.
Critical Alerts #
Critical alerts play their sound even in Do Not Disturb / silent mode. They are a channel
capability (criticalAlerts: true on the NotificationChannel); there is no
per-notification flag.
- Android: add the
ACCESS_NOTIFICATION_POLICYpermission to yourAndroidManifest.xml, and requestNotificationPermission.CriticalAlert(Android 11 and later ask the user's consent). - iOS: request the
com.apple.developer.usernotifications.critical-alertsentitlement from Apple, add it to the Runner target, and requestNotificationPermission.CriticalAlert. Critical alerts by push: see your push package's README.
Without Apple's entitlement or the user's consent, the notifications of a critical channel are shown as standard ones, without errors.
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<uses-permission android:name="android.permission.ACCESS_NOTIFICATION_POLICY"/>
<application>
...
</application>
</manifest>
Full example on how to request permissions #
A complete check-and-request, with a rationale dialog when the user must change a setting:
Future<List<NotificationPermission>> requestUserPermissions(
BuildContext context, {
// null to request the permissions of the app, not of a channel
required String? channelKey,
required List<NotificationPermission> permissionList,
}) async {
// The basic permission first
if (!await AwesomeNotifications().isNotificationAllowed() &&
!await AwesomeNotifications().requestPermissionToSendNotifications()) {
return [];
}
// The permissions already allowed
var permissionsAllowed = await AwesomeNotifications().checkPermissionList(
channelKey: channelKey, permissions: permissionList);
if (permissionsAllowed.length == permissionList.length) {
return permissionsAllowed;
}
// The ones still needed
final permissionsNeeded =
permissionList.toSet().difference(permissionsAllowed.toSet()).toList();
// The ones that need the user's intervention
final lockedPermissions = await AwesomeNotifications()
.shouldShowRationaleToRequest(
channelKey: channelKey, permissions: permissionsNeeded);
if (lockedPermissions.isEmpty) {
// Requested directly
await AwesomeNotifications().requestPermissionToSendNotifications(
channelKey: channelKey, permissions: permissionsNeeded);
} else if (context.mounted) {
// Explained first
final accepted = await showDialog<bool>(
context: context,
builder: (context) => AlertDialog(
title: const Text('Awesome Notifications needs your permission'),
content: Text('To proceed, enable: '
'${lockedPermissions.map((p) => p.name).join(', ')}'),
actions: [
TextButton(
onPressed: () => Navigator.pop(context, false),
child: const Text('Deny'),
),
TextButton(
onPressed: () => Navigator.pop(context, true),
child: const Text('Allow'),
),
],
),
);
if (accepted ?? false) {
await AwesomeNotifications().requestPermissionToSendNotifications(
channelKey: channelKey, permissions: lockedPermissions);
}
}
// After the user comes back, the permissions allowed now
return AwesomeNotifications().checkPermissionList(
channelKey: channelKey, permissions: permissionList);
}
๐ก Notification channels #
Channels group notifications that share settings: name, description, sound, vibration, LED
and importance. Create them on initialize, and later with setChannel; at least one
channel must exist on initialize. A notification on a channel that doesn't exist (or is
disabled) is refused.
On Android 8 (API 26) and later, a channel can't change after its creation, except its name
and description. For the exceptional case where you must change one, setChannel with
forceUpdate: true deletes it and creates it again under another native key. It closes every
notification of that channel: use it only when there is no other way.
The other platforms have no channels of their own: the plugin emulates them, with the same settings, so you write your channels once.
NotificationChannelGroup (on initialize) and channelGroupKey (on the channels) organize
the channels in Android's settings. A group's name can change at any time, but a channel joins
a group only when it is created.
AwesomeNotifications().setChannel: creates or updates a channel.AwesomeNotifications().removeChannel: removes a channel and closes its notifications.
Notification Channel Attributes #
| Attribute | Required | Description | Type | Updatable | Default Value |
|---|---|---|---|---|---|
channelKey |
Yes | A string key that identifies a channel where notifications are sent. | String | No | - |
channelName |
Yes | The name of the channel, which is visible to users on Android. | String | Yes | - |
channelDescription |
Yes | A brief description of the channel, which is visible to users on Android. | String | Yes | - |
channelShowBadge |
No | Whether the notification should automatically increment the app icon badge counter. | Boolean | Yes | false |
channelGroupKey |
No | A string key to group all channels in same topic at android's configuration page | String | No | - |
importance |
No | The importance level of the notification. | NotificationImportance | No | Default |
playSound |
No | Whether the notification should play a sound. | Boolean | No | true |
soundSource |
No | The path of a custom sound file to be played with the notification. | String | No | - |
defaultRingtoneType |
No | The type of default sound to be played with the notification (only for Android). | DefaultRingtoneType | Yes | Notification |
enableVibration |
No | Whether the device should vibrate when the notification is received. | Boolean | No | true |
vibrationPattern |
No | A custom vibration pattern (only for Android). | Int64List | No | - |
enableLights |
No | Whether the device should display a blinking LED when the notification is received. | Boolean | No | true |
ledColor |
No | The color of the LED to display when the notification is received. | Color | No | Colors.white |
ledOnMs |
No | The duration in milliseconds that the LED should remain on when displaying the notification. | Integer | No | - |
ledOffMs |
No | The duration in milliseconds that the LED should remain off when displaying the notification. | Integer | No | - |
groupKey |
No | The string key used to group notifications together in Android status bar. | String | No | - |
groupSort |
No | The order in which notifications within a group should be sorted. | GroupSort | No | Desc |
groupAlertBehavior |
No | The alert behavior to use for notifications within a group. | GroupAlertBehavior | No | All |
defaultPrivacy |
No | The level of privacy to apply to the notification when the device is locked. | NotificationPrivacy | No | Private |
icon |
No | The name of the notification icon to display in the status bar. | String | No | - |
defaultColor |
No | The color to use for the notification on Android. | Color | No | Colors.black |
locked |
No | Whether the notification should be prevented from being dismissed by the user. | Boolean | No | false |
onlyAlertOnce |
No | Whether the notification should only alert the user once. | Boolean | No | false |
criticalAlerts |
No | Whether the channel's notifications are critical alerts (see Critical Alerts). | Boolean | No | false |
๐ด App Badge #
The app badge counter works on every platform, as on iOS: Android, macOS and the Web show it on the app icon (where the launcher or browser supports it); Linux keeps the counter, but doesn't show it yet.
On Windows, a packaged (MSIX) app shows the system badge on its tile and taskbar button. An
unpackaged app (a plain .exe, Flutter's default) shows the number as an overlay on its
taskbar button, as Chromium and Electron apps do: it is visible while the app's window exists
(minimized included) and comes back when the app opens again.
getGlobalBadgeCounter/setGlobalBadgeCounter(amount): read or set the counter.incrementGlobalBadgeCounter/decrementGlobalBadgeCounter: change it by one.resetGlobalBadge: set it to zero.channelShowBadge: trueon a channel increments the counter for each new notification of that channel;badgeon a notification sets the counter to that value.
โฑ Chronometer and Timeout (Expiration) #
chronometer (a Duration) shows a running chronometer, starting from that value.
timeoutAfter (a Duration) dismisses the notification by itself after that time. In push
payloads, both are positive integers (seconds).
await AwesomeNotifications().createNotification(
content: NotificationContent(
id: 11,
channelKey: 'basic_channel',
title: 'Notification with Chronometer and Timeout',
body: 'Starts a chronometer and closes itself after 20 seconds',
chronometer: Duration.zero, // counts from 0 seconds
timeoutAfter: const Duration(seconds: 20), // dismissed after 20 seconds
),
);
โ๏ธ Progress Bar Notifications #
The ProgressBar layout shows a progress bar on Android (the Web shows the percentage). Set
progress (0 to 100), or leave it null for an indeterminate bar. To update it, create the
notification again with the same id, at most once per second: faster updates may be
blocked by the system.
Future<void> showProgressNotification(int id) async {
const maxStep = 10;
for (var step = 0; step <= maxStep; step++) {
final progress = (step / maxStep * 100).round();
final done = step == maxStep;
await AwesomeNotifications().createNotification(
content: NotificationContent(
id: id,
channelKey: 'progress_bar',
title: done ? 'Download finished' : 'Downloading file ($progress%)',
body: 'filename.txt',
category: NotificationCategory.Progress,
notificationLayout:
done ? NotificationLayout.Default : NotificationLayout.ProgressBar,
progress: done ? null : progress.toDouble(),
locked: !done, // the user can't dismiss it while it runs
),
);
if (!done) await Future.delayed(const Duration(seconds: 1));
}
}
๐ Emojis (Emoticons) #
The Emojis class has more than 3000 emojis to concatenate with your text. In push payloads,
use the emoji's Unicode text (from the
full emoji list), for example
\u{1f6f8}. Not every emoji is shown on every platform: test the ones you use.
await AwesomeNotifications().createNotification(
content: NotificationContent(
id: 12,
channelKey: 'basic_channel',
title: 'Emojis are awesome too! ${Emojis.smile_face_with_tongue}'
'${Emojis.smile_rolling_on_the_floor_laughing}${Emojis.emotion_red_heart}',
body: 'Simple body with a bunch of Emojis! ${Emojis.transport_police_car} '
'${Emojis.animals_dog} ${Emojis.flag_UnitedStates} ${Emojis.person_baby}',
bigPicture: 'https://tecnoblog.net/wp-content/uploads/2019/09/emoji.jpg',
notificationLayout: NotificationLayout.BigPicture,
),
);
๐จ Notification Layout Types #
Default: the default layout, also used when the chosen one can't be shown.BigPicture: a large picture, next to a small image.BigText: more than two lines of text.Inbox: a list of messages or items, one per line.ProgressBar: a progress bar, such as a download's.Messaging: a chat conversation with one person.MessagingGroup: a chat conversation with a group.MediaPlayer: a media controller with buttons.
Where a platform has no such layout, it shows the notification with the default layout.
๐ท Media Source Types #
Images take a prefix that says where they come from:
asset://: a Flutter asset. Example:asset://assets/images/balloons.pnghttp(s)://: a network image. Example:https://url.com/to/image.pngfile://: a file on the device. Example:file://path/to/image.pngresource://: a native resource (Android'sres/drawable, the asset catalog on iOS and macOS). Example:resource://drawable/res_image
Icons and sounds can only be resources.
โฌ๏ธ Notification Importance #
The importance of a channel, from the most to the least important:
Max: makes a sound and appears as a heads-up notification.High: shows everywhere, makes noise and peeks. May use full-screen intents.Default: shows everywhere, makes noise, but does not visually intrude.Low: shows in the shade, and possibly in the status bar, but makes no sound.Min: only shows in the shade, below the fold.None: disables the channel.
Use the higher levels only for critical or time-sensitive notifications: abusing them annoys the user. Like the rest of a channel, the importance can't change after its creation.
๐ Wake Up Screen Notifications #
wakeUpScreen: true turns the screen on for the notification, even when the device is
locked. On Android, add the WAKE_LOCK permission and android:turnScreenOn="true" on your
activity:
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<uses-permission android:name="android.permission.WAKE_LOCK" />
<application>
<activity
android:name=".MainActivity"
android:turnScreenOn="true">
...
</activity>
</application>
</manifest>
๐ฅ Full Screen Notifications (Android) #
fullScreenIntent: true shows the notification in full screen, even when the device is
locked. Android may open your app by itself when it shows the notification, as if the user
tapped it, so your app can show a full screen page; you can't control when that happens.
Add the USE_FULL_SCREEN_INTENT permission and android:showOnLockScreen="true" on your
activity. On Android 11 and later, request NotificationPermission.FullScreenIntent too.
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<uses-permission android:name="android.permission.USE_FULL_SCREEN_INTENT" />
<application>
<activity
android:name=".MainActivity"
android:showOnLockScreen="true">
...
</activity>
</application>
</manifest>
๐ Managing Notifications #
Every method below works on every platform:
| Method | What it does |
|---|---|
dismiss(id) |
Closes a notification shown, keeping its schedule |
dismissNotificationsByChannelKey(key) / dismissNotificationsByGroupKey(key) |
Closes the notifications of a channel / group |
dismissAllNotifications() |
Closes every notification shown |
cancel(id) |
Closes a notification and removes its schedule |
cancelNotificationsByChannelKey(key) / cancelNotificationsByGroupKey(key) |
The same, for a channel / group |
cancelAll() |
Closes every notification and removes every schedule |
isNotificationActiveOnStatusBar(id: id) |
Whether a notification is on screen |
getAllActiveNotificationIdsOnStatusBar() |
The ids of the notifications on screen |
getAppLifeCycle() |
Whether the app is in foreground, background or was terminated |
getLocalTimeZoneIdentifier() / getUtcTimeZoneIdentifier() |
The device's time zone, and UTC |
showNotificationConfigPage(channelKey: key) |
Opens the system settings of the app's (or a channel's) notifications |
showAlarmPage() |
Opens the precise alarms settings (Android) |
showGlobalDndOverridePage() |
Opens the Do Not Disturb access settings (Android) |
The schedules themselves (listing them, cancelling only the schedule) are in
awesome_notifications_schedules.
๐ Notification Structures #
The structures of a notification, as Dart objects and as the keys of a push payload. The add-on
packages add their own (schedule in
awesome_notifications_schedules,
localizations in
awesome_notifications_localizations,
and so on), documented in their READMEs.
NotificationContent ("content" in Push data) - (required) #
| Attribute | Required | Description | Type | Value Limits | Default value |
|---|---|---|---|---|---|
| id | YES | A unique identifier for the notification | int | 1 - 2,147,483,647 | - |
| channelKey | YES | The identifier of the notification channel where the notification will be displayed | String | Channel must be enabled | - |
| title | NO | The title of the notification | String | Unlimited | - |
| body | NO | The body text of the notification | String | Unlimited | - |
| titleLocKey | NO | Key to a localized title string with placeholders, to be replaced by titleLocArgs |
String | Unlimited | - |
| bodyLocKey | NO | Key to a localized body string with placeholders, to be replaced by bodyLocArgs |
String | Unlimited | - |
| titleLocArgs | NO | Arguments to replace placeholders in the localized title string, referenced by titleLocKey |
List | Unlimited | - |
| bodyLocArgs | NO | Arguments to replace placeholders in the localized body string, referenced by bodyLocKey |
List | Unlimited | - |
| summary | NO | A summary to be displayed when the notification content is protected by privacy | String | Unlimited | - |
| groupKey | NO | Groups the notifications with the same key | String | Unlimited | - |
| category | NO | The notification category that best describes the nature of the notification | NotificationCategory | - | - |
| badge | NO | The value to display as the app's badge | int | 0 - 999,999 | - |
| chronometer | NO | Shows a chronometer, starting from this value | Duration | Positive integers | - |
| timeoutAfter | NO | Dismisses the notification by itself after this time | Duration | Positive integers | - |
| showWhen | NO | Whether to show the time elapsed since the notification was posted | bool | True or false | true |
| displayOnForeground | NO | Whether to display the notification while the app is in the foreground | bool | True or false | true |
| displayOnBackground | NO | Whether to display the notification while the app is in the background | bool | True or false | true |
| icon | NO | The small icon of the notification (Android) | String | A resource image | - |
| largeIcon | NO | The large icon of the notification | String | Unlimited | - |
| bigPicture | NO | The image displayed by the BigPicture layout |
String | Unlimited | - |
| roundedLargeIcon | NO | Whether to show the large icon as a circle | bool | True or false | false |
| roundedBigPicture | NO | Whether to show the big picture as a circle | bool | True or false | false |
| customSound | NO | A sound resource for this notification | String | A resource sound | - |
| wakeUpScreen | NO | Turns the screen on (see Wake Up Screen Notifications) | bool | True or false | false |
| fullScreenIntent | NO | Shows the notification in full screen (see Full Screen Notifications) | bool | True or false | false |
| autoDismissible | NO | Whether to dismiss the notification when the user taps it | bool | True or false | true |
| color | NO | The accent color of the notification | Color | 0x000000 to 0xFFFFFF | - |
| backgroundColor | NO | The background color of the notification | Color | 0x000000 to 0xFFFFFF | - |
| payload | NO | Hidden data, delivered with the events | Map<String, String?> | Only string values | - |
| notificationLayout | NO | The layout type for the notification | NotificationLayout | - | Default |
| hideLargeIconOnExpand | NO | Whether to hide the large icon when the notification is expanded (Android) | bool | True or false | false |
| locked | NO | Whether to prevent the user from dismissing the notification (Android) | bool | True or false | false |
| progress | NO | The value of the progress bar (null for an indeterminate bar) |
double | 0.0 - 100.0 | - |
| ticker | NO | The text for accessibility services when the notification arrives | String | Unlimited | - |
| duration | NO | The media duration on media player notifications | Duration | Unlimited | - |
| playState | NO | The current playback state on media player notifications | NotificationPlayState | - | - |
| playbackSpeed | NO | The playback speed on media player notifications: 1.0 is normal, 0 when paused, negative when rewinding | double | Unlimited | - |
| actionType | NO | What a tap on the body of the notification does (see Notification Action Types) | ActionType | - | Default |
title, body, summary and the buttons' label accept basic HTML (<b>, <i>, <br>โฆ). Android draws it. The other platforms show plain text, as the user would read it: <br> and </p> become line breaks, the other tags are removed and the basic entities are read (& โ &). The app always receives the original text.
NotificationActionButton ("actionButtons" in Push data) - (optional) #
| Attribute | Required | Description | Type | Value Limits | Default value |
|---|---|---|---|---|---|
| key | YES | A text key that identifies what action the user took when they tapped the button | String | unlimited | - |
| label | YES | The text to be displayed on the action button | String | unlimited | - |
| icon | NO | The icon to be displayed inside the button (only available for few layouts) | String | Must be a resource image | - |
| color | NO | The label text color (Android) | Color | 0x000000 to 0xFFFFFF | - |
| enabled | NO | On Android, deactivates the button. On iOS, the button disappears | bool | true or false | true |
| requireInputText | NO | Asks the user to type a reply, delivered in buttonKeyInput |
bool | true or false | false |
| autoDismissible | NO | Whether the notification should be dismissed when the user taps the button | bool | true or false | true |
| showInCompactView | NO | For MediaPlayer notifications on Android, sets the button as visible in compact view | bool | true or false | false |
| isDangerousOption | NO | Whether the button is marked as a dangerous option, displaying the text in red | bool | true or false | false |
| isAuthenticationRequired | NO | The action performed by this button requires user authentication to proceed | bool | true or false | false |
| actionType | NO | What a tap on the button does | ActionType | - | Default |
๐ฑ Example Apps #
Every package has one example app, a single main.dart you can copy into a new project:
- Create a new Flutter project for the platforms you want (
flutter create my_app). - Copy the package's example (for this core,
pub.dev/packages/awesome_notifications/example)
into
lib/main.dart. - Add the packages it imports to your
pubspec.yaml. - Run it on a device, an emulator, your desktop or your browser.
To run them from the source code, clone the
repository, run flutter pub get
at its root and run the example/ folder of each package under packages/.
๐ฉบ Common Known Issues #
Issue: Notification is not showing up or is showing up inconsistently #
Fix: Check, in this order:
- The permission:
isNotificationAllowed(), and the channel's settings in the system (showNotificationConfigPage(channelKey: ...)). - The channel: it exists (created on
initializeorsetChannel) and isn't disabled; a notification on an unknown channel is refused, with an error printed whendebug: true. displayOnForeground/displayOnBackground: they hide the notification in that app state.- Battery optimization, which may delay or drop notifications on some Android devices (for
schedules, see the precision notes of
awesome_notifications_schedules).
Issue: Invalid notification content #
Fix: Each element of a notification must have the type in
Notification Structures; an invalid one makes the notification
be refused. The payload values must be strings.
โ Next steps #
- Huawei Push Kit (HMS), where Firebase Cloud Messaging doesn't reach.
- Linux: taps and buttons with the app closed.
We are constantly working to improve Awesome Notifications and provide support for new platforms and services. Stay tuned for more updates!



