flutter_local_notification_plus 0.1.0 copy "flutter_local_notification_plus: ^0.1.0" to clipboard
flutter_local_notification_plus: ^0.1.0 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.

Version 0.1.0 - Enhanced local notifications with perfect code quality! πŸš€

✨ What's New in 0.1.0 #

  • 🎯 Notification Grouping - Full support for grouped notifications on iOS and Android
  • πŸ“Š Perfect Pana Score - Achieved 160/160 points with zero static analysis issues
  • πŸ“š Enhanced Documentation - Comprehensive library-level documentation for better API discoverability
  • 🏷️ Package Topics - Added topics for better discoverability on pub.flutter-io.cn
  • πŸ’° Funding Support - Added GitHub Sponsors funding link
  • πŸ”§ Improved Compatibility - Updated SDK constraints and fixed iOS version compatibility
  • πŸ› Bug Fixes - Fixed permission handling, notification display, and BuildContext usage

Demo #

Example

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 (one-time, recurring, interval-based)
  • πŸ”” Cross-Platform: Works on iOS, Android, macOS, Windows, Linux, and Web
  • 🎨 Customizable: Extensive styling and appearance options
  • πŸ›‘οΈ Permission Handling: Built-in permission management
  • πŸ“± Badge Management: App badge support and management
  • πŸ“¦ Notification Grouping: Group related notifications together (iOS & Android)
  • 🌐 WASM Ready: WebAssembly compatibility for modern web apps
  • ✨ Perfect Code Quality: 160/160 pana score with zero static analysis issues

Getting Started #

Installation #

Add this to your package's pubspec.yaml file:

dependencies:
  flutter_local_notification_plus: ^0.1.0

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 options = {
  'icon': '/path/to/image.png',
  'badge': '1',
  'tag': 'media_notification',
};

await FlutterLocalNotificationPlus.showNotification(
  id: 3,
  title: 'Rich Media',
  body: 'Check out this image!',
  options: options,
);

Custom Actions #

final options = {
  'actions': ['accept', 'decline'],
  'sound': 'custom_sound.mp3',
  'vibration': true,
};

await FlutterLocalNotificationPlus.showNotification(
  id: 4,
  title: 'Action Required',
  body: 'Please respond to this notification',
  options: options,
);

Scheduling Options #

// Schedule for specific time
await FlutterLocalNotificationPlus.scheduleNotification(
  id: 5,
  title: 'Meeting Reminder',
  body: 'Team meeting in 30 minutes',
  scheduledDate: DateTime.now().add(Duration(minutes: 30)),
);

// Schedule recurring notification (every minute)
await FlutterLocalNotificationPlus.scheduleNotification(
  id: 6,
  title: 'Recurring Reminder',
  body: 'This repeats every minute',
  scheduledDate: DateTime.now().add(Duration(seconds: 5)),
  options: {
    'repeatInterval': 'minute', // minute, hour, day, week
  },
);

// Schedule with custom interval (every 10 seconds)
await FlutterLocalNotificationPlus.scheduleNotification(
  id: 7,
  title: 'Interval Notification',
  body: 'This repeats every 10 seconds',
  scheduledDate: DateTime.now().add(Duration(seconds: 2)),
  options: {
    'interval': 10.0, // seconds
  },
);

Notification Grouping #

// Android: Group notifications together
await FlutterLocalNotificationPlus.showNotification(
  id: 10,
  title: 'Message from Alice',
  body: 'Hey, how are you?',
  options: {
    'groupKey': 'messages', // Same group key groups them together
  },
);

// Group summary notification (Android)
await FlutterLocalNotificationPlus.showNotification(
  id: 0,
  title: 'Messages',
  body: 'You have 3 new messages',
  options: {
    'groupKey': 'messages',
    'isGroupSummary': true,
    'summaryText': '3 new messages',
  },
);

// iOS: Use threadId for grouping
await FlutterLocalNotificationPlus.showNotification(
  id: 11,
  title: 'Message from Bob',
  body: 'Can we meet tomorrow?',
  options: {
    'threadId': 'messages', // Groups notifications by thread
    'summary': '3 new messages', // Summary text for grouped notifications
  },
);

Platform Support #

Platform Status Features
Android βœ… Full Support All features available
iOS βœ… Full Support All features + SPM support
macOS βœ… Full Support All features + SPM support
Windows βœ… Full Support All features available
Linux βœ… Full Support All features available
Web βœ… Full Support WASM compatible + browser APIs

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>

Web #

For web applications, the plugin automatically handles browser notification permissions and APIs. No additional configuration is required.

API Reference #

Core Methods #

  • initialize() - Initialize the notification plugin
  • showNotification() - Display a notification immediately
  • scheduleNotification() - Schedule a notification for later
  • cancelNotification() - Cancel a specific notification
  • cancelAllNotifications() - Cancel all notifications
  • getPendingNotifications() - Get list of pending notifications
  • areNotificationsEnabled() - Check if notifications are enabled
  • requestPermissions() - Request notification permissions

Options #

  • icon - Custom notification icon
  • badge - Badge number to display
  • tag - Unique identifier for the notification (Web)
  • sound - Custom sound file
  • vibration - Enable/disable vibration (Android)
  • actions - Array of action buttons
  • image - Image attachment for rich media notifications
  • video - Video attachment (iOS)
  • audio - Audio attachment (iOS)
  • groupKey - Group key for Android notification grouping
  • isGroupSummary - Mark as group summary notification (Android)
  • summaryText - Summary text for group summary (Android)
  • threadId - Thread identifier for iOS notification grouping
  • summary - Summary text for iOS grouped notifications
  • repeatInterval - Recurring interval: 'minute', 'hour', 'day', 'week'
  • interval - Custom interval in seconds for recurring notifications

Technical Architecture #

Native Platforms #

  • Custom method channel implementation
  • Platform-specific notification APIs
  • Optimized performance with native code

Web Platform #

  • Browser notification APIs
  • WASM-compatible implementation
  • No dart:io dependencies

Swift Package Manager #

  • Native iOS and macOS support
  • Package.swift configuration
  • Full integration with Apple ecosystem

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:

  1. Check the documentation
  2. Search existing issues
  3. Create a new issue with detailed information

Changelog #

See CHANGELOG.md for a list of changes and version history.

2
likes
160
points
79
downloads

Publisher

verified publisherbechattaoui.dev

Weekly Downloads

Enhanced local notifications with rich media, actions, and scheduling for Flutter

Repository (GitHub)
View/report issues

Topics

#flutter #notifications #local-notifications #cross-platform #wasm

Documentation

API reference

Funding

Consider supporting this project:

github.com

License

MIT (license)

Dependencies

flutter, flutter_web_plugins

More

Packages that depend on flutter_local_notification_plus

Packages that implement flutter_local_notification_plus