UnifiedNotificationService class
Unified Notification Service
This service provides a unified interface for showing notifications across all platforms (Android, iOS, Web, Linux, macOS, Windows).
It automatically uses the best notification system for each platform:
- Desktop (Linux, macOS, Windows): local_notifier
- Mobile (Android, iOS): notification_master
- Web: notification_master
Usage:
// Initialize once in main()
await UnifiedNotificationService.initialize(appName: 'my_app');
// Show notifications anywhere
await UnifiedNotificationService.showNotification(
title: 'Hello',
message: 'World',
);
Constructors
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Properties
Static Methods
-
getPlatformName(
) → String - Get the current platform name
-
initialize(
{required String appName}) → Future< void> - Initialize notification service for all platforms
-
showBigTextNotification(
{required String title, required String message, required String bigText}) → Future< void> - Show big text notification (mobile only)
-
showImageNotification(
{required String title, required String message, required String imageUrl}) → Future< void> - Show notification with image (mobile/web only)
-
showNotification(
{required String title, required String message, String? subtitle, bool silent = false, VoidCallback? onClick, VoidCallback? onShow, dynamic onClose(String)?}) → Future< void> - Show a simple notification on any platform
-
showNotificationWithActions(
{required String title, required String message, required List< String> actions, dynamic onActionClick(int)?, VoidCallback? onClick}) → Future<void> - Show notification with action buttons