mac_notifications 1.1.0+1 copy "mac_notifications: ^1.1.0+1" to clipboard
mac_notifications: ^1.1.0+1 copied to clipboard

discontinuedreplaced by: flutter_local_notifications

Display macOS notifications from Flutter and get answer from a reply.

Mac Notifications #

This package helps you to display a notification on macOS platform. You can highly customize this notification.

NOTE: To be able to use this package, you must be on master Flutter channel.

Installation #

See Installing tab to see how to integrate.

Wherever you want to use this plugin, do

import 'package:mac_notifications/mac_notifications.dart';

Use #

Here's a basic usage example. See example folder on (GitHub)[https://github.com/beagle-barks/flutter_mac_notification_plugin/] for more information.

Basic notification #

try {
     MacNotifications.showNotification(
       MacNotificationOptions(
           identifier: 'test-notifications',
           title: 'Hello',
           subtitle: 'This is a notification from Flutter to Mac',
           informative:
               'And it runs smoothly with almost no cost when implementing ;)',),
     );
} on PlatformException {}

Notification with reply #

try {
     MacNotifications.showNotification(
       MacNotificationOptions(
           identifier: 'test-notifications',
           title: 'Hello',
           subtitle: 'This is a notification from Flutter to Mac',
           informative:
               'And it runs smoothly with almost no cost when implementing ;)',
           hasReplyButton: true,
           replyPlaceholder: 'Your answer goes here',
           ),
     );
} on PlatformException {}

Get the reply #

To get the text the user enters in a reply notification, you can simply use a StreamBuilder or StreamSubscription.

StreamBuilder<String>(
  stream: MacNotifications.getAnswers,
  builder: (context, snapshot) {
      if (snapshot.data == null)
         return Text(
           'Your answer goes here.',
           style: TextStyle(
             fontWeight: FontWeight.bold,
           ),
         );
         return Text(
           snapshot.data,
           style: TextStyle(
             fontWeight: FontWeight.bold,
           ),
         );
      },
)
12
likes
40
pub points
0%
popularity

Publisher

unverified uploader

Display macOS notifications from Flutter and get answer from a reply.

Repository (GitHub)
View/report issues

License

Apache-2.0 (LICENSE)

Dependencies

flutter

More

Packages that depend on mac_notifications