Local notifications are scheduled on the device, with no server and no push service. They are the right tool for reminders the app already knows about: a daily habit nudge, a timer, a “your trial ends tomorrow” note. In Flutter, the standard package is flutter_local_notifications.
The code is short. The traps are platform rules: Android permissions, exact alarms, time zones and an iOS cap. This post covers each, plus how to test. It is part of building a Flutter app with Claude Code. If you need messages sent from a server, read Flutter push notifications with Firebase instead.
Install and Android build setup
Add the package plus timezone, which scheduling needs:
flutter pub add flutter_local_notifications timezone
The package requires Android core library desugaring (it says this applies “even without scheduled notifications”). In android/app/build.gradle.kts, enable isCoreLibraryDesugaringEnabled = true in compileOptions and add the desugar_jdk_libs dependency at the version the README lists. The README also sets minimum compileSdk and Android Gradle Plugin versions, which go up with major releases, so check them when you upgrade.
For scheduled notifications that survive a reboot, the manifest needs the RECEIVE_BOOT_COMPLETED permission and the plugin’s ScheduledNotificationReceiver and ScheduledNotificationBootReceiver inside <application>. Copy the exact XML from the README’s Android setup section.
Initialize
final notifications = FlutterLocalNotificationsPlugin();
Future<void> initNotifications() async {
const android = AndroidInitializationSettings('ic_notification');
const darwin = DarwinInitializationSettings(
requestAlertPermission: false,
requestBadgePermission: false,
requestSoundPermission: false,
);
await notifications.initialize(
settings: const InitializationSettings(android: android, iOS: darwin),
onDidReceiveNotificationResponse: (response) {
// Route using response.payload.
},
);
}
Two details. The Android icon name must be a drawable resource in your app (android/app/src/main/res/drawable/). And the iOS permission flags are set to false on purpose, so the system prompt does not appear on first launch. You ask later, in context.
The current release uses named parameters (settings:, id:), as shown here. Older releases used positional ones, so match the examples to your installed version.
Ask for permission at the right moment
Android 13+. POST_NOTIFICATIONS is a runtime permission. Google: on Android 13 or higher “your app’s notifications are off by default” for new installs until the user grants it. With the plugin:
await notifications
.resolvePlatformSpecificImplementation<
AndroidFlutterLocalNotificationsPlugin>()
?.requestNotificationsPermission();
iOS.
await notifications
.resolvePlatformSpecificImplementation<
IOSFlutterLocalNotificationsPlugin>()
?.requestPermissions(alert: true, badge: true, sound: true);
When to ask: Google’s advice is “Before you ask users to grant any permissions, let them familiarize themselves with your app,” and to request “in the correct context, so that it’s explicitly clear what the notifications are used for.” A good moment is right after the user creates their first reminder. More on this in push notification best practices and onboarding best practices.
Set up time zones
zonedSchedule takes a TZDateTime, so the timezone package must know the device’s zone:
import 'package:timezone/data/latest_all.dart' as tz;
import 'package:timezone/timezone.dart' as tz;
Future<void> initTimeZones(String deviceZoneName) async {
tz.initializeTimeZones();
tz.setLocalLocation(tz.getLocation(deviceZoneName));
}
The plugin’s docs note that timezone cannot detect the device zone by itself, so get the name from a package such as flutter_timezone or a platform channel. Skip this and every reminder fires at the right UTC time and the wrong local time.
Schedule a daily reminder
tz.TZDateTime nextInstanceOf(int hour, int minute) {
final now = tz.TZDateTime.now(tz.local);
var at = tz.TZDateTime(tz.local, now.year, now.month, now.day, hour, minute);
if (at.isBefore(now)) at = at.add(const Duration(days: 1));
return at;
}
Future<void> scheduleDailyReminder() async {
await notifications.zonedSchedule(
id: 1,
title: 'Time for today\'s session',
body: 'Five minutes keeps the streak alive.',
scheduledDate: nextInstanceOf(19, 30),
notificationDetails: const NotificationDetails(
android: AndroidNotificationDetails(
'reminders', 'Reminders',
channelDescription: 'Daily practice reminders',
),
iOS: DarwinNotificationDetails(),
),
androidScheduleMode: AndroidScheduleMode.inexactAllowWhileIdle,
matchDateTimeComponents: DateTimeComponents.time,
);
}
matchDateTimeComponents: DateTimeComponents.time repeats daily at that time. Use dayOfWeekAndTime for weekly. Keep IDs stable (one per reminder type) so rescheduling replaces instead of duplicating.
Exact or inexact on Android
androidScheduleMode is required. The options range from inexact to exactAllowWhileIdle and alarmClock. The AllowWhileIdle variants still fire when the device is in low-power idle mode.
Prefer inexact. Android 14 changed the rules: SCHEDULE_EXACT_ALARM is “no longer being pre-granted to most newly installed apps targeting Android 13 and higher (will be set to denied by default).” The alternative, USE_EXACT_ALARM, is meant for calendar and alarm clock apps, and Google says apps “will not be able to publish a version of their app with this permission in the manifest unless they qualify.” See Play permissions and sensitive APIs policy.
If your app truly needs exact timing (a medication alarm), declare SCHEDULE_EXACT_ALARM, call the plugin’s requestExactAlarmsPermission(), and fall back to inexact if the user says no. For a habit reminder, inexact is fine.
iOS: the 64 limit
The plugin’s docs: iOS keeps only “the 64 most recently set notifications” on versions newer than iOS 9. If you schedule one notification per day for three months, most will silently vanish. Use repeating notifications (matchDateTimeComponents) instead of many one-offs, and reschedule a rolling window when the app opens.
Manage what is scheduled
final pending = await notifications.pendingNotificationRequests();
await notifications.cancel(id: 1);
await notifications.cancelAll();
Give users a settings toggle and time picker, and call cancel when they turn reminders off. Cancel reminders that no longer make sense, for example after a user completes today’s task.
How to test
- Schedule one minute ahead from a debug menu, then background the app and lock the device.
- Check
pendingNotificationRequests()after scheduling to confirm the date, in local time. - Reboot an Android device and confirm reminders survive (this tests the boot receiver).
- Revoke the permission to test the denied path. Google lists
adb shell pm revoke PACKAGE_NAME android.permission.POST_NOTIFICATIONSfor this. - Turn off exact alarms in Settings > Apps > Special app access > Alarms & reminders, as Google suggests, and confirm the app still works.
- Change the device time zone and confirm the reminder still fires at the local time.
- Tap the notification from a killed app and check it opens the right screen. If you route with go_router, see Flutter deep links with go_router.
Add these to your mobile app QA checklist.
Use them sparingly
Google notes users “can see the number of daily notifications that your app sends” and can revoke the permission at any time. One useful reminder a day at a time the user picked keeps the permission. Three generic ones lose it. MobileKit’s retention skill sets caps and timing rules like these before any reminder ships.
Sources read on the day this post was written: flutter_local_notifications on pub.dev, FlutterLocalNotificationsPlugin API, Android: Notification runtime permission and Android 14: Schedule exact alarms denied by default.