Skip to content

BlueBubblesApp/local_notifier

 
 

Repository files navigation

local_notifier

pub version

This plugin allows Flutter desktop apps to displaying local notifications.


English | 简体中文


Platform Support

Linux macOS Windows
✔️ ✔️ ✔️

Screenshots

macOS Linux Windows
image

Quick Start

Installation

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

dependencies:
  local_notifier: ^0.1.6

Or

dependencies:
  local_notifier:
    git:
      url: https://github.com/leanflutter/local_notifier.git
      ref: main

Linux requirements

  • libnotify

Run the following command

sudo apt-get install libnotify-dev

Usage

// Add in main method.
await localNotifier.setup(
  appName: 'local_notifier_example',
  // The parameter shortcutPolicy only works on Windows
  shortcutPolicy: ShortcutPolicy.requireCreate,
);

LocalNotification notification = LocalNotification(
  title: "local_notifier_example",
  body: "hello flutter!",
);
notification.onShow = () {
  print('onShow ${notification.identifier}');
};
notification.onClose = (closeReason) {
  // Only supported on windows, other platforms closeReason is always unknown.
  switch (closeReason) {
    case LocalNotificationCloseReason.userCanceled:
      // do something
      break;
    case LocalNotificationCloseReason.timedOut:
      // do something
      break;
    default:
  }
  print('onClose ${_exampleNotification?.identifier} - $closeReason');
};
notification.onClick = () {
  print('onClick ${notification.identifier}');
};
notification?.onClickAction = (actionIndex) {
  print('onClickAction ${notification?.identifier} - $actionIndex');
};

notification.show();

Please see the example app of this plugin for a full example.

Who's using it?

Related Links

License

MIT

About

This plugin allows Flutter desktop apps to notify local notifications.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C++ 69.8%
  • CMake 12.3%
  • Dart 11.4%
  • Swift 3.3%
  • C 1.8%
  • Ruby 1.4%