flutter_local_notification_plus 0.0.1
flutter_local_notification_plus: ^0.0.1 copied to clipboard
Enhanced local notifications with rich media, actions, and scheduling for Flutter
flutter_local_notification_plus #
Enhanced local notifications with rich media, actions, and scheduling for Flutter.
Features #
- 🎯 Rich Media Support: Display images, videos, and audio in notifications
- ⚡ Advanced Actions: Custom notification actions and responses
- 📅 Flexible Scheduling: Schedule notifications with precise timing
- 🔔 Cross-Platform: Works on iOS, Android, macOS, Windows, and Linux
- 🎨 Customizable: Extensive styling and appearance options
- 🛡️ Permission Handling: Built-in permission management
- 📱 Badge Management: App badge support and management
Getting Started #
Installation #
Add this to your package's pubspec.yaml file:
dependencies:
flutter_local_notification_plus: ^0.0.1
Basic Usage #
import 'package:flutter_local_notification_plus/flutter_local_notification_plus.dart';
// Initialize the plugin
await FlutterLocalNotificationPlus.initialize();
// Show a simple notification
await FlutterLocalNotificationPlus.showNotification(
id: 1,
title: 'Hello!',
body: 'This is a notification',
);
// Schedule a notification
await FlutterLocalNotificationPlus.scheduleNotification(
id: 2,
title: 'Scheduled',
body: 'This notification was scheduled',
scheduledDate: DateTime.now().add(Duration(minutes: 5)),
);
Advanced Features #
Rich Media Notifications #
final notificationDetails = NotificationDetails(
android: AndroidNotificationDetails(
'rich_media_channel',
'Rich Media',
channelDescription: 'Notifications with rich media content',
styleInformation: BigPictureStyleInformation(
DrawableResourceAndroidBitmap('@drawable/notification_image'),
),
),
);
await FlutterLocalNotificationPlus.showNotification(
id: 3,
title: 'Rich Media',
body: 'Check out this image!',
notificationDetails: notificationDetails,
);
Custom Actions #
final notificationDetails = NotificationDetails(
android: AndroidNotificationDetails(
'actions_channel',
'Actions',
channelDescription: 'Notifications with custom actions',
actions: [
AndroidNotificationAction('accept', 'Accept'),
AndroidNotificationAction('decline', 'Decline'),
],
),
);
Scheduling Options #
// Schedule for specific time
await FlutterLocalNotificationPlus.scheduleNotification(
id: 4,
title: 'Meeting Reminder',
body: 'Team meeting in 30 minutes',
scheduledDate: DateTime.now().add(Duration(minutes: 30)),
);
// Schedule for specific date and time
final scheduledDate = DateTime(2024, 12, 25, 9, 0); // Christmas morning
await FlutterLocalNotificationPlus.scheduleNotification(
id: 5,
title: 'Christmas!',
body: 'Merry Christmas!',
scheduledDate: scheduledDate,
);
Platform Support #
| Platform | Status | Notes |
|---|---|---|
| Android | ✅ Full Support | All features available |
| iOS | ✅ Full Support | All features available |
| macOS | ✅ Full Support | All features available |
| Windows | ✅ Full Support | All features available |
| Linux | ✅ Full Support | All features available |
Configuration #
Android #
Add the following permissions to your android/app/src/main/AndroidManifest.xml:
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
<uses-permission android:name="android.permission.VIBRATE"/>
<uses-permission android:name="android.permission.WAKE_LOCK"/>
<uses-permission android:name="android.permission.SCHEDULE_EXACT_ALARM"/>
iOS #
Add the following to your ios/Runner/Info.plist:
<key>UIBackgroundModes</key>
<array>
<string>fetch</string>
<string>remote-notification</string>
</array>
API Reference #
Core Methods #
initialize()- Initialize the notification pluginshowNotification()- Display a notification immediatelyscheduleNotification()- Schedule a notification for latercancelNotification()- Cancel a specific notificationcancelAllNotifications()- Cancel all notificationsgetPendingNotifications()- Get list of pending notificationsareNotificationsEnabled()- Check if notifications are enabledrequestPermissions()- Request notification permissions
Notification Details #
AndroidNotificationDetails- Android-specific settingsDarwinNotificationDetails- iOS/macOS-specific settingsLinuxNotificationDetails- Linux-specific settingsWindowsNotificationDetails- Windows-specific settings
Contributing #
Contributions are welcome! Please feel free to submit a Pull Request.
License #
This project is licensed under the MIT License - see the LICENSE file for details.
Support #
If you encounter any issues or have questions, please:
- Check the documentation
- Search existing issues
- Create a new issue with detailed information
Changelog #
See CHANGELOG.md for a list of changes and version history.