js_notifications
An extended NotificationsAPI for Dart managing web notifications.
1.0.0
5.0K downloads/mo
#3836 most downloaded on pub.dev
cybex-dev/js_notifications
What this package is like to depend on
Last release 29 days ago
26 Jul 2026
Release timing varies
gaps range from 2 months to 1.3 years
Nearly every release is documented
notes for 8 of 8 stable releases
Nothing withdrawn
no release was ever pulled
2 years old
8 releases · first in 2024
1 release in the last 12 months
see the full history below
Release timeline
8 releases · Sep 2024 to Jul 2026Releases
latest 8-
1.0.026 Jul 2026Release notes
Open source →What's Changed
- feat: Add WASM support with web package by @cybex-dev in #2
- fix: update
badgetoString?by @cybex-dev in #3 - feat: add bundled service worker by @cybex-dev in #4
Full Changelog: 0.0.5...1.0.0
Release notes
Open source →- Zero-setup service worker:
js_notifications-sw.jsnow ships as a bundled Flutter asset of the package (deployed atassets/packages/js_notifications/assets/) and is registered automatically — manually copying the file into your app'sweb/folder is no longer required. Existing copied files can be deleted; legacy registrations are unregistered automatically on startup. - Service worker URL now resolves against the document base URI, fixing deployments under a
non-root
<base href>. ServiceWorkerManageris now a singleton (ServiceWorkerManager.instance, or the factory constructor to assign event callbacks) — a page has one service worker registration, and the manager owns the listeners attached to it.- Service worker setup moved out of the
ServiceWorkerManagerconstructor into an explicit, idempotentinit(). The plugin calls it automatically on registration and exposesinitialize()(returns whether the worker registered) andisInitialized. Notifications posted before initialisation completes now wait for it instead of being dropped with "No service worker ready". - Added
registerServiceWorker({url, scope})— replace the bundled worker with a custom script (e.g. customsendActionhandling), register the bundled worker under a custom scope, or both. ThescopeUrlsetter now works (previously ineffective): it re-registers the current worker under the new scope. Note: scopes outside the worker script's directory require aService-Worker-Allowedresponse header from the server. - Fixed: service worker updates are now adopted. When a byte-different worker was deployed,
the plugin kept posting to the previous (now redundant) worker and notifications silently
stopped working until a page reload. Updates are tracked via
updatefoundon the plugin's own registration; the new worker is adopted once it reachesactivated, with aredundantfallback to the registration's active worker. - Fixed:
controllerchangeno longer adoptsnavigator.serviceWorker.controller. The controller is the worker controlling the page — never this plugin's worker, whose scope controls no pages — so a controller change (e.g. Flutter's ownflutter_service_worker.jsupdating) could redirectpostMessageto a worker that ignores the plugin's protocol. - Fixed service worker script bugs: error-logger shadowing in the
showNotificationcatch handler,console.warnargument spreading; renamed SW log tagcallkit_sw→js_notifications_sw. - WebAssembly support: full migration off deprecated
dart:htmltopackage:web+dart:js_interop— the package now compiles withflutter build web --wasm. - BREAKING:
badgeis nowString?— the URL of the monochrome badge image, per the Web API'sNotification.badge(previously mistyped asint?, which browsers ignored; not to be confused with the numeric Badging API,navigator.setAppBadge). - BREAKING:
vibrateis nowList<int>?(previouslyweb.VibratePattern?);package:webtypes no longer appear in the public API. - BREAKING: minimum Flutter version raised to 3.22 (stable WASM toolchain floor).
- BREAKING:
SWEventsconstants for events that never dispatch on page-side objects were removed (push,pushsubscriptionchange,sync,install,activate,fetch— these fire inside the worker's own global scope);updatefoundwas added. - Internal: service worker event wiring now uses
EventStreamProvidersubscriptions; removed ~10 dead no-op event listeners that never fired on page-side objects.ServiceWorkerManager.dispose()now cancels and clears every subscription and resets state, soinit()can run again afterwards. - Added
deepCastMap/deepCastValuehelpers (lib/utils/utils.dart) used to normalisedartify()output into theMap<String, dynamic>shape the plugin uses for event payloads. - Added
bundledSwAssetPathandbundledSwAssetDirMarkerconstants;defaultScopeis retained for legacy-registration migration. isSupportednow feature-detects theNotificationglobal (dart:html'sNotification.supportedhas nopackage:webequivalent).- Note: under the WASM runtime, integral JS numbers in notification
datapayloads may be delivered back to Dart asdouble— treat round-tripped numbers asnum.
-
0.0.504 Apr 2025 -
0.0.401 Apr 2025Release notes
Open source →Changelog:
- Fix
JsNotificationDirection'stoString()conversion - Added
autotoJSNotificationDirection
Full Changelog: 0.0.2...0.0.4
Release notes
Open source →- Fix
JsNotificationDirection'stoString()conversion - Added
autotoJSNotificationDirection
- Fix
-
0.0.328 Jan 2025Release notes
Open source →- Added notification accessors and notification getters (via caching)
- Fixed notification on tap stream not triggering
-
0.0.3+128 Jan 2025 -
0.0.3+228 Jan 2025 -
0.0.3+328 Jan 2025 -
0.0.124 Sep 2024Release notes
Open source →Initial release
Full Changelog: https://github.com/cybex-dev/js_notifications/commits/0.0.1