v1: Remove _async suffix from all methods, remove fire-n-forget counterparts#5537
Merged
FeodorFitsner merged 8 commits intomainfrom Aug 12, 2025
Merged
v1: Remove _async suffix from all methods, remove fire-n-forget counterparts#5537FeodorFitsner merged 8 commits intomainfrom
_async suffix from all methods, remove fire-n-forget counterparts#5537FeodorFitsner merged 8 commits intomainfrom
Conversation
Removed all synchronous wrapper methods that used asyncio.create_task to call async methods for focus, scrolling, launching URLs, and other UI actions. Updated all example usages and documentation to use async/await directly, ensuring a consistent asynchronous API surface. This change simplifies the codebase, reduces confusion between sync and async methods, and prepares for future async-only usage patterns.
Deploying flet-docs with
|
| Latest commit: |
1b68f8c
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://d1cc9968.flet-docs.pages.dev |
| Branch Preview URL: | https://v1-remove-method-async.flet-docs.pages.dev |
Replaces the FLET_TEST_USE_FVM environment variable with FLET_TEST_DISABLE_FVM to control whether Flutter tests are run directly or via fvm. Updates documentation, CI configuration, and test app logic to reflect this change, ensuring consistency and clarity in test execution across environments.
ndonkoHenri
reviewed
Aug 11, 2025
ndonkoHenri
reviewed
Aug 11, 2025
Replaces usage of asyncio.create_task with dedicated async handler functions for button clicks and link taps in several Flet Python example files. This improves code readability and aligns with best practices for async event handling.
Renamed environment variable FLET_TEST_SIMILARITY_THRESHOLD to FLET_TEST_SCREENSHOTS_SIMILARITY_THRESHOLD and updated related documentation and code. Replaced FletTestApp.pixel_ratio and similarity_threshold with screenshots_pixel_ratio and screenshots_similarity_threshold, respectively. Updated test code and internal logic to use new names and improved FletTestApp constructor with explicit arguments and documentation. Also made Page.can_launch_url asynchronous.
ndonkoHenri
reviewed
Aug 12, 2025
sdk/python/packages/flet/src/flet/controls/core/canvas/canvas.py
Outdated
Show resolved
Hide resolved
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR standardizes asynchronous method naming across the Flet codebase by removing the "_async" suffix from all async methods and eliminating their non-awaitable fire-and-forget wrapper counterparts. The changes consolidate on single awaitable methods for controls, services, and APIs while updating documentation and examples to reflect the new naming convention.
Key changes:
- Renamed all methods from
method_async()tomethod()and removed non-async wrappers - Updated internal invocation from
_invoke_method_asyncto_invoke_method - Modified examples, tests, and documentation to use the new async method signatures
Reviewed Changes
Copilot reviewed 85 out of 85 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
sdk/python/packages/flet/src/flet/testing/tester.py |
Updated method calls from _invoke_method_async to _invoke_method |
sdk/python/packages/flet/src/flet/testing/flet_test_app.py |
Enhanced documentation and renamed method calls to use new naming convention |
sdk/python/packages/flet/src/flet/controls/services/ |
Removed _async suffix from all service methods and eliminated wrapper methods |
sdk/python/packages/flet/src/flet/controls/material/ |
Updated button and form controls to use new async method naming |
sdk/python/packages/flet/src/flet/controls/core/ |
Updated core controls like Window, View, Screenshot to use new method names |
sdk/python/packages/flet/src/flet/auth/ |
Renamed auth provider and service methods to remove _async suffix |
| Examples and documentation | Updated all code samples to use new async method names |
sdk/python/Taskfile.yml |
Renamed pytest task to tests and added control-tests target |
Changed the teardown method in Tester to be asynchronous and updated its implementation to use await. Also clarified docstrings in Canvas methods by removing references to asynchronous behavior.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Close #5531
Summary by Sourcery
Standardize asynchronous method naming by removing the “_async” suffix and eliminating fire-and-forget wrappers, consolidating on single awaitable methods across controls, services, and APIs.
Enhancements:
Build:
Documentation: