搜索插件、代码仓与 APP 分类

local_notifier 封面
插件详情v0.1.6

local_notifier

此插件允许 Flutter 桌面应用程序显示本地通知。

macOSWindowsLinux
近 30 天下载
4.9万
喜欢数
116
Pub 分数
150

安装插件

flutter pub add local_notifier

插件介绍

基于插件公开信息、社区数据与项目使用情况整理的选型参考。

local_notifier 包使 Flutter 桌面应用程序能够在 macOS、Windows 和 Linux 上显示本地通知。它提供了一个简单的接口,用于安排和显示系统级通知,而无需依赖外部服务。专为桌面平台设计,它与原生通知系统集成,以及时传递警报。该插件轻量且易于实现,非常适合需要提醒、状态更新或用户警报的应用程序。它支持基本的通知功能,如标题、正文和图标显示。

适合场景

  • 桌面应用程序提醒
  • 系统级警报
  • 任务完成通知
  • 用户活动跟踪
  • 应用状态更新

主要特点

  • 原生桌面通知集成
  • 跨平台支持(macOS、Windows、Linux)
  • 用于调度和显示通知的简单 API
  • 支持自定义图标
  • 轻量级且依赖项最少

适合对象

  • Flutter 开发人员构建桌面应用程序
  • 需要本地警报功能的应用程序
  • 针对多个桌面操作系统的开发者
  • 需要轻量级通知解决方案的项目

使用建议

  • 仅限桌面平台
  • 不支持移动设备
  • 通知行为因操作系统而异
  • 需要平台特定配置以启用高级功能
  • 不支持富媒体或交互式通知

原始 README

以下为关联源码仓库的 README 原文快照,最新内容请访问源码仓库。

🚀 Ship Your App Faster: Try Fastforge - The simplest way to build, package and distribute your Flutter apps.

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

  • https://github.com/mohabouje/WinToast

License

MIT

所属分类

依赖

依赖清单 1 项

源码仓库

使用此插件的项目