Skip to content

Add the flet-notifications extension - #6977

Closed
Nwokike wants to merge 1 commit into
flet-dev:flet-1.1.0from
Nwokike:flet-notifications
Closed

Nwokike wants to merge 1 commit into
flet-dev:flet-1.1.0from
Nwokike:flet-notifications

Conversation

@Nwokike

@Nwokike Nwokike commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

Description

Adds the flet-notifications extension (Fixes #6948): a LocalNotifications service wrapping flutter_local_notifications 22.x for Android, iOS, macOS, Windows, Linux and Web.

  • show, schedule (zoned, daily, weekly, periodic), periodically_show, cancel/cancel_all/cancel_pending
  • permission requests and probes, exact-alarm and full-screen-intent permissions, notification-policy access
  • Android channels and groups, foreground service, progress notifications
  • rich styles: big text, big picture, inbox, messaging (+ Person, Message, AndroidIcon)
  • actions with inline reply, typed on_tap/on_action/on_dismissed handlers, replay of taps that arrived while the app was not running
  • per-platform options: AndroidOptions, DarwinOptions, LinuxOptions, WindowsOptions, WebOptions

Layout follows flet-local-auth / flet-secure-storage: Python package plus the Dart package under src/flutter/flet_notifications. Registered in the client, sdk/python/pyproject.toml, packages/flet/pyproject.toml, the build-test app, crocodocs and CI.

The Android plugin needs scheduled-notification receivers and core-library-desugaring Gradle flags that [tool.flet.android.*] cannot declare, so the package ships an idempotent flet-notifications-patch console script that injects them into a built project (documented on the service docs page).

Test code

import flet as ft
from flet_notifications import LocalNotifications


def main(page: ft.Page):
    notifications = LocalNotifications()

    async def notify(e):
        if await notifications.request_permissions():
            await notifications.show(id=1, title="Hello", body="Hello from Flet")

    page.add(ft.OutlinedButton("Notify", on_click=notify))


ft.run(main)

Type of change

  • New feature (non-breaking change which adds functionality)

Checklist

  • I signed the CLA.
  • I have performed a self-review of my own code.
  • My code follows the style guidelines of this project.
  • I have commented my code, particularly in hard-to-understand areas.
  • My changes generate no new warnings.
  • New and existing tests pass locally with my changes.
  • I have made corresponding documentation changes, if applicable.
  • I have added changelog entries for user-facing changes, if applicable.

Additional details

  • 100 tests ported to packages/flet/integration_tests/extensions/notifications with explicit @pytest.mark.asyncio markers (matching flet's own tests), passing locally; ruff check and docstr-coverage pass for the new package.
  • No Flutter SDK on this machine: dart analyze, the client builds and client/pubspec.lock regeneration are unverified locally. The Dart package's 70 widget/unit tests come along in src/flutter/flet_notifications/test.
  • The Dart code imports only package:flutter/widgets.dart and dart:ui, so the 1.1.0 material_ui/cupertino_ui migration does not apply to it.
  • PyPI: flet-notifications 0.1.0 to 0.1.4 are published under my account. Happy to transfer the project to the flet org so CI keeps the name, or rename, once you decide.

`LocalNotifications` service wrapping flutter_local_notifications for Android,
iOS, macOS, Windows, Linux and Web: show, schedule (zoned, daily, weekly,
periodic), cancel, permissions and probes, Android channels and foreground
service, rich styles (big text/picture/inbox/messaging), inline-reply actions
and typed on_tap/on_action/on_dismissed handlers.

The plugin needs scheduled-notification receivers and core-library-desugaring
Gradle flags that [tool.flet.android.*] cannot declare, so the package ships an
idempotent `flet-notifications-patch` console script for the built project.
@sourcery-ai

sourcery-ai Bot commented Oct 15, 2026

Copy link
Copy Markdown
Contributor

Sorry @Nwokike, your pull request is larger than the review limit of 150,000 diff characters

@FeodorFitsner

Copy link
Copy Markdown
Contributor

Thank you for the PR!

You will need to transfer ownership of https://pypi.org/project/flet-notifications/ to Flet, so we could publish it from CI and maintain.

@Nwokike

Nwokike commented Oct 18, 2026

Copy link
Copy Markdown
Contributor Author

@FeodorFitsner I've invited the "flet" PyPI account as an Owner, and the invitation is pending. Since the account already maintains Flet's other packages, would this be sufficient for your team to take over maintenance and CI publishing?

@FeodorFitsner

Copy link
Copy Markdown
Contributor

@FeodorFitsner I've invited the "flet" PyPI account as an Owner, and the invitation is pending. Since the account already maintains Flet's other packages, would this be sufficient for your team to take over maintenance and CI publishing?

Yes, got access to it. Thanks for a quick turnaround. Local notifications will be an awesome (and long-awaited) addition to Flet!

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Missing Dart implementation files block client compilation, and Android build configuration and patching need correction.

4 open issues
What changed in this PR

Introduces flet-notifications to expose local notifications through Flet’s service API, addressing #6948.

Changes:

  • Adds Python notification APIs, platform options, serialization and Android patching.
  • Registers the extension in the client, workspace, build-test app and CI.
  • Adds examples, documentation and Python/Dart tests.
File Description
website/​sidebars.yml Adds notification navigation.
website/​docs/​services/​notifications/​types/​windowsscenario.md Documents Windows scenarios.
website/​docs/​services/​notifications/​types/​windowsoptions.md Documents Windows options.
website/​docs/​services/​notifications/​types/​weboptions.md Documents browser options.
website/​docs/​services/​notifications/​types/​visibility.md Documents visibility values.
website/​docs/​services/​notifications/​types/​style.md Documents the style union.
website/​docs/​services/​notifications/​types/​responsetype.md Documents response types.
website/​docs/​services/​notifications/​types/​repeatinterval.md Documents repeat intervals.
website/​docs/​services/​notifications/​types/​priority.md Documents priority values.
website/​docs/​services/​notifications/​types/​person.md Documents messaging participants.
website/​docs/​services/​notifications/​types/​pendingnotification.md Documents pending notifications.
website/​docs/​services/​notifications/​types/​notificationoptions.md Documents combined options.
website/​docs/​services/​notifications/​types/​notificationevent.md Documents notification events.
website/​docs/​services/​notifications/​types/​notificationerrorcode.md Documents error codes.
website/​docs/​services/​notifications/​types/​notificationerror.md Documents notification errors.
website/​docs/​services/​notifications/​types/​notificationchannel.md Documents Android channels.
website/​docs/​services/​notifications/​types/​notificationactioninput.md Documents reply inputs.
website/​docs/​services/​notifications/​types/​notificationaction.md Documents action buttons.
website/​docs/​services/​notifications/​types/​messagingstyle.md Documents messaging style.
website/​docs/​services/​notifications/​types/​message.md Documents message records.
website/​docs/​services/​notifications/​types/​linuxurgency.md Documents Linux urgency.
website/​docs/​services/​notifications/​types/​linuxoptions.md Documents Linux options.
website/​docs/​services/​notifications/​types/​launchdetails.md Documents launch details.
website/​docs/​services/​notifications/​types/​interruptionlevel.md Documents interruption levels.
website/​docs/​services/​notifications/​types/​inboxstyle.md Documents inbox style.
website/​docs/​services/​notifications/​types/​importance.md Documents channel importance.
website/​docs/​services/​notifications/​types/​groupalertbehavior.md Documents group alerts.
website/​docs/​services/​notifications/​types/​datetimecomponents.md Documents calendar recurrence.
website/​docs/​services/​notifications/​types/​darwinoptions.md Documents Apple options.
website/​docs/​services/​notifications/​types/​bigtextstyle.md Documents expanded text.
website/​docs/​services/​notifications/​types/​bigpicturestyle.md Documents expanded images.
website/​docs/​services/​notifications/​types/​androidschedulemode.md Documents Android scheduling.
website/​docs/​services/​notifications/​types/​androidoptions.md Documents Android options.
website/​docs/​services/​notifications/​types/​androidicon.md Documents icon sources.
website/​docs/​services/​notifications/​types/​activenotification.md Documents active notifications.
website/​docs/​services/​notifications/​index.md Adds setup and usage guidance.
tools/​crocodocs/​pyproject.toml Registers API documentation sources.
sdk/​python/​pyproject.toml Adds workspace integration.
sdk/​python/​packages/​flet/​pyproject.toml Adds the extension dependency.
sdk/​python/​packages/​flet/​integration_tests/​extensions/​notifications/​test_styles.py Tests style serialization.
sdk/​python/​packages/​flet/​integration_tests/​extensions/​notifications/​test_service.py Tests service calls and exports.
sdk/​python/​packages/​flet/​integration_tests/​extensions/​notifications/​test_scheduling.py Tests scheduling arguments.
sdk/​python/​packages/​flet/​integration_tests/​extensions/​notifications/​test_probes.py Tests queries and permissions.
sdk/​python/​packages/​flet/​integration_tests/​extensions/​notifications/​test_patcher.py Tests Android patching.
sdk/​python/​packages/​flet/​integration_tests/​extensions/​notifications/​test_options.py Tests platform options.
sdk/​python/​packages/​flet/​integration_tests/​extensions/​notifications/​test_events.py Tests event hydration.
sdk/​python/​packages/​flet/​integration_tests/​extensions/​notifications/​test_channels.py Tests channels and foreground services.
sdk/​python/​packages/​flet/​integration_tests/​extensions/​notifications/​test_actions.py Tests actions and error helpers.
sdk/​python/​packages/​flet-notifications/​src/​flutter/​flet_notifications/​test/​scheduling_test.dart Tests scheduling conversion.
sdk/​python/​packages/​flet-notifications/​src/​flutter/​flet_notifications/​test/​response_events_test.dart Tests response normalization and replay.
sdk/​python/​packages/​flet-notifications/​src/​flutter/​flet_notifications/​test/​parsers_test.dart Tests notification parsers.
sdk/​python/​packages/​flet-notifications/​src/​flutter/​flet_notifications/​test/​notifications_service_test.dart Tests platform method mapping.
sdk/​python/​packages/​flet-notifications/​src/​flutter/​flet_notifications/​pubspec.yaml Declares Flutter dependencies.
sdk/​python/​packages/​flet-notifications/​src/​flutter/​flet_notifications/​analysis_options.yaml Enables Flutter lint rules.
sdk/​python/​packages/​flet-notifications/​src/​flutter/​flet_notifications/​.gitignore Excludes generated artifacts.
sdk/​python/​packages/​flet-notifications/​src/​flet_notifications/​types.py Defines notification enums.
sdk/​python/​packages/​flet-notifications/​src/​flet_notifications/​styles.py Defines rich notification styles.
sdk/​python/​packages/​flet-notifications/​src/​flet_notifications/​scheduling.py Serializes scheduling arguments.
sdk/​python/​packages/​flet-notifications/​src/​flet_notifications/​patcher.py Patches Android manifests and Gradle.
sdk/​python/​packages/​flet-notifications/​src/​flet_notifications/​options.py Defines platform-specific options.
sdk/​python/​packages/​flet-notifications/​src/​flet_notifications/​local_notifications.py Implements the Python service API.
sdk/​python/​packages/​flet-notifications/​src/​flet_notifications/​events.py Defines query result records.
sdk/​python/​packages/​flet-notifications/​src/​flet_notifications/​channels.py Defines Android channel configuration.
sdk/​python/​packages/​flet-notifications/​src/​flet_notifications/​base.py Defines events and error helpers.
sdk/​python/​packages/​flet-notifications/​src/​flet_notifications/​actions.py Defines actions and reply inputs.
sdk/​python/​packages/​flet-notifications/​src/​flet_notifications/​__init__.py Exports the public API.
sdk/​python/​packages/​flet-notifications/​README.md Introduces the package.
sdk/​python/​packages/​flet-notifications/​pyproject.toml Configures packaging and patch command.
sdk/​python/​packages/​flet-notifications/​LICENSE Adds an Apache license reference.
sdk/​python/​examples/​extensions/​notifications/​notifications/​pyproject.toml Configures the example project.
sdk/​python/​examples/​extensions/​notifications/​notifications/​main.py Demonstrates notification features.
sdk/​python/​examples/​apps/​flet_build_test/​src/​main.py Imports the extension for build checks.
sdk/​python/​examples/​apps/​flet_build_test/​pyproject.toml Adds build-test dependencies.
client/​pubspec.yaml Adds the Flutter package dependency.
client/​lib/​main.dart Registers the notification extension.
CHANGELOG.md Announces the extension.
.github/​workflows/​ci.yml Adds package build and publishing entries.

Review effort: Balanced

Comment thread client/lib/main.dart
Comment on lines +19 to +20
import 'package:flet_notifications/flet_notifications.dart'
as flet_notifications;
Comment thread client/pubspec.yaml
Comment on lines +82 to +83
flet_notifications:
path: ../sdk/python/packages/flet-notifications/src/flutter/flet_notifications
Comment on lines +213 to +214
if existing:
return []
Comment on lines +36 to +38
flet build apk --yes --project myapp --org com.example -v
flet-notifications-patch --project-root build/flutter
cd build/flutter/android && ./gradlew assembleRelease -Psplit-per-abi=true
@ndonkoHenri

ndonkoHenri commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Hi @Nwokike, thanks for your PR.

fyi: I am working on significantly improving your work to make it better and so it best fits the Flet codebase standard/style.

For example, we won't have to "patch" on Android anymore, as I will make flet build support the new settings through pyproject config.

@Nwokike

Nwokike commented Oct 20, 2026

Copy link
Copy Markdown
Contributor Author

That’s exactly why I was happy to hand it over. You guys know the Flet codebase better than I do, so I trust your judgment on how best to implement it.

@ndonkoHenri

Copy link
Copy Markdown
Contributor

@Nwokike Thanks for your PR! It laid the foundations. Closing it in favor of #6999.

@Nwokike
Nwokike deleted the flet-notifications branch October 25, 2026 17:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants