Skip to content

refactor!: Remove all deprecated APIs for a deprecation-free 1.0#6693

Open
ndonkoHenri wants to merge 9 commits into
release/flet-1.0from
fix/remove-deprecations
Open

refactor!: Remove all deprecated APIs for a deprecation-free 1.0#6693
ndonkoHenri wants to merge 9 commits into
release/flet-1.0from
fix/remove-deprecations

Conversation

@ndonkoHenri

@ndonkoHenri ndonkoHenri commented Jul 18, 2026

Copy link
Copy Markdown
Contributor

Prepares Flet for a deprecation-free 1.0 by removing every deprecated API from shipping source — both the version-scheduled deprecations (0.88 → 1.0) and the ones that had no scheduled removal. A multi-agent audit across all 24 Python and 19 Dart packages confirms zero active deprecations remain.

Removed

Controls & events

  • DragTargetEvent.x / .y / .offset → use local_position / global_position
  • ConstrainedControl → inherit from LayoutControl
  • ElevatedButton → use Button
  • Video.show_controls (→ controls=None), Video.playlist_add() / playlist_remove() (→ mutate Video.playlist)

Page

  • Page.go()Page.push_route()
  • Page.url_launcher / browser_context_menu / shared_preferences / clipboard / storage_paths → instantiate the service classes directly (UrlLauncher(), etc.)
  • Page.launch_url() / can_launch_url() / close_in_app_web_view()UrlLauncher().*

App entry

  • app() / app_async()run() / run_async()
  • run(target=...) / run_async(target=...) → pass main
  • FletApp.show_app_startup_screen / app_startup_screen_messageboot_screen_options

Colors — 14 non-underscored aliases (BLACK12WHITE70) → underscored names (Colors.BLACK_12); Colors reverted to a plain Enum

CLI / build

  • --clear-cache flag of flet build / flet debugflet clean
  • Legacy [tool.flet.app.boot_screen] / [tool.flet.app.startup_screen] config → [tool.flet.boot_screen]

Dart — empty-string ("") widget-state key back-compat → use "default"

Notes

  • DropdownM2 is kept and un-deprecated — its 0.84.0 deprecation in favor of Dropdown is reverted; it remains a supported control.
  • Migrated 9 examples + the auth cookbook doc off the removed page.launch_url() to ft.UrlLauncher().
  • Fixed a pre-existing bug in 4 flet_map examples: SimpleAttribution.on_click=lambda e: <async launch_url> never awaited the coroutine (click did nothing) → replaced with proper async def handlers.

⚠️ Breaking changes

All of the above are breaking. See the ## 1.0.0 section of CHANGELOG.md and the updated 0.85.0 / 0.86.0 migration guides.

Summary by Sourcery

Remove all previously deprecated public APIs across Python, Dart, CLI, and video packages in preparation for a deprecation-free 1.0 release.

Bug Fixes:

  • Fix flet_map examples where SimpleAttribution on_click handlers silently ignored async launch_url coroutines by wiring them through proper async functions.

Enhancements:

  • Simplify core APIs by removing deprecated navigation, service accessor, app entry, layout, button, color, and video helpers and aliases, requiring the modern replacements instead.
  • Drop legacy CLI and build configuration fallbacks, including the --clear-cache build flag and old boot_screen/startup_screen config sections, to align tooling with current commands and settings.
  • Remove Dart-side backward-compat behavior for empty-string widget state keys, standardizing on the "default"/ControlState.DEFAULT key.
  • Undeprecate DropdownM2 so it remains a supported control and revert Colors to a plain Enum without deprecation metadata.

Documentation:

  • Document all 1.0.0 breaking removals in the main changelog and video package changelog.
  • Update breaking-change guides and authentication docs to reflect the final removal versions and the UrlLauncher-based navigation pattern.
  • Refresh multiple Python examples (Markdown, audio recorder, context menu, maps, Trolli app) to stop using removed APIs and rely on the new services instead.

…rols APIs

Removes APIs deprecated in 0.85.0 as part of the pre-v1 deprecation cleanup:

- DragTargetEvent.x/.y/.offset -> use local_position / global_position
- Video.show_controls -> set controls=None to hide controls
- Video.playlist_add()/playlist_remove() -> mutate Video.playlist directly

Also simplifies the flet_video Dart control (the show_controls gate is now
dead code) and updates the root + flet-video changelogs and the 0.85.0
migration guides.
… flag

Continues the pre-1.0 deprecation cleanup:

- Remove FletApp.show_app_startup_screen and FletApp.app_startup_screen_message
  (deprecated in 0.86.0) -> use boot_screen_options
- Remove the --clear-cache flag of flet build / flet debug (deprecated in
  0.86.0) -> use the flet clean command; the flag's build/flutter deletion
  behavior is removed with it
- Finalize the cleanup changelog version placeholder from 'Unreleased' to
  1.0.0 (root + flet-video changelogs and the 0.85.0/0.86.0 migration-guide
  timelines)
Continues the pre-1.0 deprecation cleanup:

- Remove Page.go() (deprecated in 0.80.0) -> use Page.push_route()
- Remove the Page.url_launcher, Page.browser_context_menu,
  Page.shared_preferences, Page.clipboard, and Page.storage_paths service
  accessors (deprecated in 0.80.0) -> instantiate the service classes
  directly: UrlLauncher(), BrowserContextMenu(), SharedPreferences(),
  Clipboard(), StoragePaths()
- Migrate two examples off the removed accessors
… Colors aliases

Completes the scheduled (1.0) deprecation removals:

- Remove the ConstrainedControl base class (deprecated 0.80.0) -> inherit
  from LayoutControl
- Remove ElevatedButton (deprecated 0.80.0) -> use Button
- Remove DropdownM2 and the dropdownm2 module, incl. its Dart widget and
  control registration (deprecated 0.84.0) -> use Dropdown
- Remove the 14 deprecated non-underscored Colors aliases (BLACK12..WHITE70)
  -> use the underscored names; revert Colors to a plain Enum
- Clean up flet package exports, delete the DropdownM2 docs page and sidebar
  entry, and migrate one example type annotation to ft.Button
…ee 1.0

Sweeps the deprecations that had no scheduled removal version:

- Remove app() and app_async() (deprecated 0.80.0) -> use run()/run_async()
- Remove the target= alias parameter of run()/run_async() -> pass main
- Remove Page.launch_url()/can_launch_url()/close_in_app_web_view()
  (deprecated 0.90.0) -> use UrlLauncher()
- Remove the legacy [tool.flet.app.boot_screen]/[tool.flet.app.startup_screen]
  build-config fallback -> use [tool.flet.boot_screen]
- Remove the Dart empty-string widget-state key back-compat mapping -> 'default'
- Migrate 8 examples + the authentication cookbook doc off page.launch_url() to
  ft.UrlLauncher().launch_url() (and fix a stale web_window_name kwarg)
Reverses the DropdownM2 removal from 76e33fa and drops its deprecation:

- Restore the Python control, the Dart widget + its control registration,
  and the docs page
- Strip the @deprecated_class decorator (and its import) so DropdownM2 is no
  longer deprecated
- Re-add the flet package exports (class + module) and the sidebar entry

DropdownM2 remains a supported control; its 0.84.0 deprecation in favor of
Dropdown is reverted.
…waited)

SimpleAttribution.on_click used `lambda e: ft.UrlLauncher().launch_url(...)`,
but launch_url is async — Flet's sync-handler dispatch calls the lambda and
discards the returned coroutine, so it was never awaited and the click did
nothing. Replace with a proper `async def` handler that Flet awaits. This was a
pre-existing bug (the prior `page.launch_url()` form was also async).
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jul 18, 2026

Copy link
Copy Markdown

Deploying flet-website-v2 with  Cloudflare Pages  Cloudflare Pages

Latest commit: 218947c
Status: ✅  Deploy successful!
Preview URL: https://d7b7bce0.flet-website-v2.pages.dev
Branch Preview URL: https://fix-remove-deprecations.flet-website-v2.pages.dev

View logs

@sourcery-ai sourcery-ai Bot 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.

Hey - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Point the 1.0.0 CHANGELOG entries (root + flet-video) at the removal PR
#6693 instead of the original deprecation PRs, and add #6693 to the References
of the drag-target/video/clear-cache migration guides.

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.

Pull request overview

This PR prepares Flet for a deprecation-free 1.0 by removing previously deprecated public APIs across Python, Dart, CLI tooling, docs, and examples, and updating references to their supported replacements.

Changes:

  • Removed deprecated Python APIs (navigation helpers, service accessors, legacy controls, color aliases) and updated exports accordingly.
  • Removed deprecated CLI/build flags and legacy build config fallbacks, aligning tooling with current commands/config keys.
  • Updated docs, changelogs, Dart back-compat behavior, and multiple examples to use the new APIs (e.g., UrlLauncher(), Button, "default" widget-state key).

Reviewed changes

Copilot reviewed 30 out of 30 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
website/docs/updates/breaking-changes/v0-86-0/deprecated-clear-cache-flag.md Updates timeline/references for --clear-cache removal in 1.0.0.
website/docs/updates/breaking-changes/v0-85-0/deprecated-video-apis.md Updates timeline/references for deprecated Video APIs removal in 1.0.0.
website/docs/updates/breaking-changes/v0-85-0/deprecated-drag-target-event-coordinates.md Updates timeline/references for drag event coordinate fields removal in 1.0.0.
website/docs/cookbook/authentication.md Migrates auth flow URL opening to ft.UrlLauncher() APIs.
sdk/python/packages/flet/src/flet/controls/page.py Removes deprecated Page.go() and URL-launch/service accessor helpers.
sdk/python/packages/flet/src/flet/controls/material/elevated_button.py Removes deprecated ElevatedButton wrapper (file deleted).
sdk/python/packages/flet/src/flet/controls/material/dropdownm2.py Undeprecates DropdownM2 by removing its deprecation wrapper.
sdk/python/packages/flet/src/flet/controls/layout_control.py Removes deprecated ConstrainedControl alias in favor of LayoutControl.
sdk/python/packages/flet/src/flet/controls/core/flet_app.py Removes deprecated boot screen convenience properties from FletApp.
sdk/python/packages/flet/src/flet/controls/core/drag_target.py Removes deprecated DragTargetEvent coordinate aliases.
sdk/python/packages/flet/src/flet/controls/colors.py Removes deprecated color aliases and reverts Colors to a plain Enum.
sdk/python/packages/flet/src/flet/app.py Removes deprecated app()/app_async() and target= aliasing in run()/run_async().
sdk/python/packages/flet/src/flet/init.py Stops exporting removed/legacy symbols (e.g., app, ConstrainedControl, ElevatedButton).
sdk/python/packages/flet-video/src/flutter/flet_video/lib/src/video.dart Drops show_controls handling on the Dart side.
sdk/python/packages/flet-video/src/flet_video/video.py Removes deprecated Video.show_controls and playlist helper methods.
sdk/python/packages/flet-video/CHANGELOG.md Documents removed video APIs in the flet-video 1.0.0 changelog.
sdk/python/packages/flet-cli/src/flet_cli/commands/build_base.py Removes deprecated --clear-cache flag and legacy boot/startup screen config fallback.
sdk/python/examples/extensions/map/multi_layers/main.py Fixes attribution click handling by awaiting URL launch via UrlLauncher().
sdk/python/examples/extensions/map/interaction_flags/main.py Fixes attribution click handling by awaiting URL launch via UrlLauncher().
sdk/python/examples/extensions/map/idle_camera/main.py Fixes attribution click handling by awaiting URL launch via UrlLauncher().
sdk/python/examples/extensions/map/camera_controls/main.py Fixes attribution click handling by awaiting URL launch via UrlLauncher().
sdk/python/examples/extensions/charts/line_chart/line_chart_with_custom_axes/main.py Updates handler typing/usages to Button after ElevatedButton removal.
sdk/python/examples/extensions/audio_recorder/audio_recorder/main.py Migrates page.launch_url() usage to UrlLauncher().
sdk/python/examples/controls/material/context_menu/triggers/main.py Migrates page.browser_context_menu usage to BrowserContextMenu().
sdk/python/examples/controls/core/markdown/markdown/main.py Migrates page.launch_url() usage to UrlLauncher().
sdk/python/examples/controls/core/markdown/listviews/main.py Migrates page.launch_url() usage to UrlLauncher().
sdk/python/examples/controls/core/markdown/code_syntax_highlight/main.py Migrates page.launch_url() usage to UrlLauncher().
sdk/python/examples/apps/declarative/trolli/components/dialogs.py Migrates page.shared_preferences accessor usage to SharedPreferences().
packages/flet/lib/src/utils/widget_state.dart Removes Dart-side empty-string widget-state key back-compat mapping.
CHANGELOG.md Adds 1.0.0 breaking changes entry documenting all removals/changes.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread website/docs/cookbook/authentication.md
Comment thread website/docs/cookbook/authentication.md
…_context_menu

The ContextMenu docstring linked `:attr:`flet.Page.browser_context_menu``,
which this PR removes — leaving an unresolved reST xref that failed the docs
build's cross-reference check (`docs/controls/contextmenu`). Point it at the
`BrowserContextMenu` service directly. Verified locally with the full
`yarn build` + `check_docs` sequence — all checks pass.
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.

2 participants