flutter_awesome_notification 1.1.0
flutter_awesome_notification: ^1.1.0 copied to clipboard
A comprehensive notification plugin for Flutter with FCM, local notifications, and intelligent filtering.
1.1.0 #
✨ Generic Plugin Refactoring #
This major update makes the plugin truly generic and reusable across any Flutter application by removing app-specific filtering logic and making it configurable via callbacks.
🆕 New Features
- Generic Filtering System: All filtering logic moved to app-specific
customFiltercallback - Custom Notification Details: Support for custom
NotificationDetailsper notification for different urgency levels - Enhanced API: Added optional
notificationDetailsparameter toshowLocalNotification()andscheduleNotification()
🔧 Improvements
- Plugin Reusability: Can now be used in any Flutter app without modification
- Simplified Configuration: Removed app-specific config options (
enableActionStepFiltering,enableChatRoomFiltering, etc.) - Better Documentation: Updated README with generic usage examples
- Type Safety: Exported
NotificationDetails,AndroidNotificationDetails,DarwinNotificationDetailstypes
🛠️ Breaking Changes
-
Configuration Simplification: Removed the following config options (now handled by
customFilter):enableActionStepFilteringenableChatRoomFilteringisActiveChatRoomchatPageRoutenotificationTypeToPageallowedNotificationTypes
-
Filtering Logic: All app-specific filtering must now be implemented in the
customFiltercallback
📝 Migration Guide
Before (1.0.0):
FlutterAwesomeNotificationConfig(
firebaseOptions: DefaultFirebaseOptions.currentPlatform,
enableActionStepFiltering: true,
enableChatRoomFiltering: true,
isActiveChatRoom: (roomId) => checkIfActive(roomId),
chatPageRoute: 'chat-page',
)
After (1.1.0):
FlutterAwesomeNotificationConfig(
firebaseOptions: DefaultFirebaseOptions.currentPlatform,
customFilter: (messageData) async {
// Your app-specific filtering logic
final type = messageData['type'];
final userId = messageData['excludeUserId'];
final currentUserId = getCurrentUserId();
// Don't show user's own actions
if (type == 'action_step_completion' && userId == currentUserId) {
return false; // Filter out
}
// Don't show notifications when user is in chat
final pageName = messageData['pageName'];
if (pageName == 'chat-page' && isUserInChat(messageData['id'])) {
return false; // Filter out
}
return true; // Show notification
},
)
📚 Documentation Updates
- Updated README with generic examples
- Added migration guide for existing users
- Improved configuration documentation
- Added filtering examples
✅ Benefits
- Universal Plugin: Can be used in any Flutter app
- Flexible Filtering: Apps implement their own business logic
- Simplified Maintenance: Plugin focuses on infrastructure, not business rules
- Better Architecture: Separation of concerns between plugin and app logic
1.0.0 #
🚀 Stable Release #
A comprehensive, production-ready notification plugin for Flutter apps with Firebase Cloud Messaging (FCM) and local notifications. This stable 1.0.0 release features a streamlined architecture focused on foreground notification handling with intelligent filtering and seamless navigation.
Features
- ✅ Foreground Notification Handling: Intelligent filtering and display when app is active
- ✅ Navigation Integration: Custom callbacks for seamless navigation handling
- ✅ Topic Subscriptions: Easy FCM topic management
- ✅ Local Notifications: Immediate and scheduled local notifications
- ✅ Highly Configurable: Builder pattern with sensible defaults
- ✅ Minimal Code: Easy setup with very little boilerplate
- ✅ FCM Token Management: Automatic token handling and refresh
- ✅ Custom Logging: Integrate with your preferred logging solution
- ✅ Type-Safe: Full type safety with comprehensive configuration
Architecture
-
Core Components:
FlutterAwesomeNotification: Main service orchestratorFlutterAwesomeNotificationConfig: Configuration with sensible defaultsForegroundNotificationHandler: Handles foreground message filteringLocalNotificationManager: Manages local notification display and scheduling
-
App State Handling:
- Foreground: Plugin processes and displays notifications with filtering
- Background/Terminated: System displays notifications, plugin handles navigation on tap
Example Usage
await FlutterAwesomeNotification.initialize(
config: FlutterAwesomeNotificationConfig(
firebaseOptions: DefaultFirebaseOptions.currentPlatform,
onNotificationTap: (data) => print('Tapped: $data'),
onNavigate: (pageName, id, data) => handleNavigation(pageName, id),
),
);
FCM Payload Requirements
For reliable notification delivery across all app states:
{
"notification": {
"title": "New Message",
"body": "You have a new message"
},
"data": {
"pageName": "chat-room",
"id": "room123"
}
}
Note: Include the notification field for consistent delivery.
Documentation
- Complete README with usage examples and app state explanations
- Migration guide for existing notification implementations
- Comprehensive example apps (basic usage + custom handler)
- Inline documentation for all public APIs
Dependencies
firebase_core: ^3.8.0firebase_messaging: ^15.1.5flutter_local_notifications: ^19.1.0timezone: ^0.10.1
Notes
- Requires Flutter SDK
>=3.3.0 - Dart SDK
^3.8.1 - Must be initialized before
Firebase.initializeApp() - Handles foreground notifications with intelligent filtering
- Navigation works seamlessly across all app states