Viewing version 3.1.1. Open the latest package page.

flutter_local_notifications_windows

3.1.1

Windows implementation of the flutter_local_notifications plugin

Download archive

Readme

flutter_local_notifications_windows

The Windows implementation of package:flutter_local_notifications as an FFI package that can be run in plain Dart or as a Flutter plugin. See the docs on FFI.

Limitations

Project structure

This template uses the following structure:

  • src: Contains the native source code, and a CmakeFile.txt file for building that source code into a dynamic library. Within this folder, there are three C++ files:

    • ffi_api.h/ffi_api.cpp: A C-compatible header file with the API that will be used by Dart, and the C++ implementation of that API
    • plugin.hpp/plugin.cpp: A C++ class holding handles to the C++/WinRT SDK, along with some Windows-heavy logic. ffi_api.cpp implements its features using this class.
    • utils.hpp/utils.cpp handle copying and allocating data from C structs to WinRT classes and vice-versa. Since FFI is done over C-based APIs, C++ types like strings, maps, and vectors need to be translated.
  • lib: Contains the Dart code that defines the API of the plugin, and which calls into the native code using dart:ffi.

    • The details folder holds all the Windows-specific notification configurations such as WindowsAction, WindowsImage, etc.
    • The ffi folder holds the generated bindings (see below) and other FFI utilities.
    • The plugin folder implements package:flutter_local_notifications_platform_interface in two ways: a stub for platforms that don't support FFI, and an FFI-based implementation.
  • The windows folder contains the build files for building and bundling the native code library with the platform application.

Building and bundling native code

The code in src can be built with CMake. A build.bat file is included, which has the following code:

@echo off
cd build
cmake ../windows
cmake --build .
cd ..
copy build\shared\Debug\flutter_local_notifications_windows.dll .

This generates a DLL from the native code and copies it to the current directory. This is useful for testing locally without Flutter. When using Flutter, this step is unnecessary as Flutter will build and bundle the assets for you.

Binding to native code

To use the native code, bindings in Dart are needed. To avoid writing these by hand, they are generated from the header file src/ffi_api.h by package:ffigen. Regenerate the bindings by running dart run ffigen --config ffigen.yaml.

Changelog

[3.1.1]

  • Suppress warning around usage of experimental coroutines. This is to fix issue #2777

[3.1.0]

  • Updated periodicallyShow() to accept payload and notificationDetails as optional parameters
  • Bumped xml dependency so that supported range is >=6.5.0 <8.0.0
  • Bumped dependency on flutter_local_notifications_platform_interface

[3.0.0]

  • Breaking change bumped minimum Flutter SDK requirement to 3.38.1 and Dart SDK requirement to 3.10.0
  • Bumped timezone dependency

[2.0.1]

[2.0.0]

  • Breaking change bumped minimum Flutter SDK requirement to 3.32.0 and Dart SDK requirement to 3.8.0
  • Breaking changes the positional parameters in the following methods have now been converted to named parameters
    • initialize()
    • show()
    • showRawXml()
    • periodicallyShow()
    • periodicallyShowWithDuration()
    • cancel()
    • zonedSchedule()
    • zonedScheduleRawXml()
  • Breaking changes to align with the main the plugin, the following parameters have been renamed
    • the details parameter in the show() and zonedSchedule() methods has been renamed to notificationDetails
    • the onNotificationReceived in the initialize() method has been renamed to onDidReceiveNotificationResponse
  • Breaking change removed the details parameter from the zonedScheduleRawXml() method as it was not actually used. Thanks to the PR from Levi Lesches
  • Bumped ffigen and regenerated bindings. Credits to Levi Lesches who originally looked at this before the plugin had its minimum Flutter version bumped
  • Added flutter_lints to apply linter rules

[1.0.3]

  • Fixed issue where non-ASCII characters for the notification application name weren't being displayed properly. Thanks to the PR from yoyoIU

[1.0.2]

  • Fixed issue #2648 where non-ASCII characters in the notification payload were not being handled properly. Thanks to the PR from yoyoIU

[1.0.1]

  • Fixed issue #2651 where unresolved symbols occurred with changes in introduced in newer Windows SDKs. Thanks to the PR from Sebastien

[1.0.0]

Installing

export PUB_HOSTED_URL=https://pub.mirror.p-hatan.com
flutter pub add 'flutter_local_notifications_windows:3.1.1'
pubspec.yaml
name: flutter_local_notifications_windows
description: Windows implementation of the flutter_local_notifications plugin
version: 3.1.1
homepage: https://github.com/MaikuB/flutter_local_notifications/tree/master/flutter_local_notifications_windows
issue_tracker: https://github.com/MaikuB/flutter_local_notifications/issues

environment:
  sdk: ^3.10.0
  flutter: ">=3.38.1"

dependencies:
  flutter:
    sdk: flutter
  ffi: ^2.1.2
  flutter_local_notifications_platform_interface: ^12.0.0
  meta: ^1.11.0
  timezone: ^0.11.0
  xml: ">=6.5.0 <8.0.0"

dev_dependencies:
  ffigen: ^20.1.1
  flutter_lints: ^6.0.0
  test: ^1.25.2

flutter:
  plugin:
    implements: flutter_local_notifications
    platforms:
      windows:
        ffiPlugin: true
        dartPluginClass: FlutterLocalNotificationsWindows

Version history

VersionPublishedArchiveSHA-256
1.0.0-dev.1On demandDownload0888485c…892522
1.0.0-dev.2On demandDownload181b45d2…4b8212
1.0.0-dev.3On demandDownload282bb8af…4419e4
1.0.0-dev.4On demandDownload3fcc00dc…1cb5a2
1.0.0On demandDownloadf8fc0652…773e6e
1.0.1On demandDownload593625e6…540d86
1.0.2On demandDownloaded46d7ae…74ec98
1.0.3On demandDownload8d658f0d…668aaf
2.0.0-dev.1On demandDownloadd42ed88f…64f80d
2.0.0-dev.2On demandDownload6f794ec3…fda86c
2.0.0-dev.3On demandDownloadaa1bc3f7…92f44b
2.0.0On demandDownload7ddd964f…46da61
2.0.1On demandDownloade97a1a30…56b02a
3.0.0-dev.1On demandDownloade7136082…2384d4
3.0.0On demandDownload3a2654ba…1bef0c
3.1.0-dev.1On demandDownload0fb30300…dceb96
3.1.0-dev.2On demandDownload2ec0b816…1b145e
3.1.0On demandDownload5aeed973…5201e1
3.1.1Cached · Upstream SHA-256 matchedDownload6f43bdd0…382945
4.0.0-dev.1On demandDownload048c2efd…1e71cb
4.0.0-dev.2On demandDownload9eea91ae…7a870b

Dependencies

ffi "^2.1.2"

flutter { "sdk": "flutter" }

flutter_local_notifications_platform_interface "^12.0.0"

meta "^1.11.0"

timezone "^0.11.0"

xml "\u003e=6.5.0 \u003c8.0.0"