-
Notifications
You must be signed in to change notification settings - Fork 600
flet debug: the new CLI for testing Flet apps on mobile devices
#5865
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Replaces 'flutter_build' with 'run_flutter' in build and debug commands, consolidating command execution logic. Updates method names for clarity and moves status updates and logging to command-specific implementations. Improves code maintainability and consistency across build and debug workflows.
Introduces a --release flag to the debug command, allowing users to build the app in release mode. Also updates argument handling to support the new option.
Eliminates the pre-configured 'io.flutter.embedding.android.EnableImpeller' meta-data from both the CLI implementation and documentation, reflecting updated defaults for Android publishing.
Moved shared build logic from build.py to a new build_base.py, introducing BaseBuildCommand for common build functionality. Updated build.py to inherit from BaseBuildCommand instead of BaseFlutterCommand, and adjusted imports accordingly. This improves code organization and reuse for build-related CLI commands.
Bump the required Flutter version from 3.38.2 to 3.38.3 in both .fvmrc and flutter_base.py to ensure compatibility with the latest release.
Introduces a new 'devices' command to list connected devices via Flutter. Refactors build and debug commands to use a unified 'initialize_command' method, moving progress and verbose handling to the base class. Updates CLI registration to include the new devices command.
Improves device listing in the CLI by parsing and displaying connected devices in a formatted table, adds platform labels, and restricts device choices to iOS and Android. Refactors the cleanup method to accept richer message types (including Panel and Group) and removes its implementation from build_base.py, consolidating it in flutter_base.py. Updates usages in build.py and debug.py to use Panel for success messages.
Introduces --device-timeout and --device-connection arguments to filter devices by connection type and set timeout for device detection. Updates device table columns and parsing logic to support these new options.
Added unified platform labeling for devices and updated status messages in devices.py to reflect the selected platform. Console log messages for Flutter, JDK, and Android SDK installation in flutter_base.py are now shown only in verbose mode for cleaner output.
Introduces a new 'emulators' command for listing, creating, and launching emulators. Refactors argument parsing for several commands to use 'type=str.lower' for case-insensitive choices. Adds platform label mapping to BaseFlutterCommand and improves device and debug command output formatting.
Replaces 'package_platform' and 'config_platform' with 'require_android_sdk' for device and emulator commands, simplifying platform checks. Updates desktop support logic to use system platform detection instead of config_platform. This improves clarity and maintainability of platform-specific initialization.
Introduces a '--yes' CLI option to automatically confirm dependency installations and adds a user prompt before installing the Android SDK if minimal packages are not present. Refactors AndroidSDK to include a static method for checking minimal package installation.
Introduces the --delete option to the emulators command, allowing users to delete Android emulators by ID or name. Refactors output formatting to optionally remove panel borders, updates device and emulator table layouts, and adds the delete_avd method to AndroidSDK for managing AVDs.
Added documentation pages for the 'flet devices' and 'flet emulators' CLI commands and updated mkdocs navigation to include them.
Simplifies emulator command interface by replacing multiple flags (--launch, --create, --delete) with positional 'action' and 'emulator' arguments. Adds validation for emulator names, improves error handling, and updates help messages and output to reflect new usage. This change streamlines command usage and improves user feedback for invalid input.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry @FeodorFitsner, your pull request is larger than the review limit of 150000 diff characters
|
The previous flet run --android/--ios workflow relied on the Flet mobile testing app, which limited the ability to test native functionalities like push notifications, permission handling (e.g., location, camera), and third-party native SDKs without first building a full APK/IPA. Does the new flet debug command resolve this? Does it allow us to fully test these native features in the emulator or on a device like flutter without performing a final release build (APK/IPA) every time?" |
|
Yes, "Flet" app will stay there too and allows quick experience your app on a mobile device, but with limited capabilities (not all permissions are enabled and the app itself is running on your computer). |
|
@FeodorFitsner any chance of stable release on v1 in December 2025 |
|
Absolutely! We are going to release a stable Flet v1 Beta before Xmas. |
Thanks, a special request before launching stable v1 kindly improve app initial loading times when first UI screen appears or give a option to place any icon there.... And on windows hot reload sometime crashes and application stuck and need to restart kindly resolve these issue too... |
Refactored Flutter SDK installation logic to prompt users before installing if the SDK is missing or invalid, and added get_flutter_dir utility for consistent SDK path resolution. Enhanced batch file detection to check the expected install directory first, and standardized user prompts for SDK installation.
Deploying flet-docs with
|
| Latest commit: |
34ac8ae
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://e795168e.flet-docs.pages.dev |
| Branch Preview URL: | https://flet-debug.flet-docs.pages.dev |
There was a problem hiding this comment.
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 introduces three new CLI commands for testing Flet apps on mobile devices and emulators:
flet debug- runs Flet apps on specified devices/emulatorsflet devices- lists connected iOS/Android devicesflet emulators- manages iOS/Android emulators
Key changes include:
- Major code refactoring: extracting common functionality from
build.pyinto new base classes (BaseFlutterCommandandBaseBuildCommand) - Adding Android SDK AVD management capabilities
- Updating Flutter version from 3.38.2 to 3.38.3
- Adding documentation for new commands
Reviewed changes
Copilot reviewed 17 out of 17 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
commands/flutter_base.py |
New base class for Flutter commands with common initialization logic |
commands/build_base.py |
New base class for build-related commands, extracted from build.py |
commands/build.py |
Refactored to extend BaseBuildCommand, significantly reduced code |
commands/debug.py |
New command for running apps on devices in debug mode |
commands/devices.py |
New command for listing connected devices |
commands/emulators.py |
New command for managing emulators |
commands/publish.py |
Added type=str.lower for argument normalization |
commands/create.py |
Added type=str.lower for argument normalization, unused variable fix |
utils/android_sdk.py |
Added AVD management methods |
utils/flutter.py |
Extracted get_flutter_dir() function |
cli.py |
Registered new commands |
docs/ |
Added documentation files for new commands |
.fvmrc |
Updated Flutter version to 3.38.3 |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
sdk/python/packages/flet-cli/src/flet_cli/commands/emulators.py
Outdated
Show resolved
Hide resolved
Replaced usage of update_version() with from_git() for dynamic version retrieval throughout CLI and desktop modules. Removed unused imports and obsolete methods from build_base.py. Updated devices.py and emulators.py to import BaseFlutterCommand from flutter_base instead of build_base for better separation of concerns.
Added support for responding to ListTile click events in RadioControl by listening to a notifier from ListTileClicks. This enables radio controls to react to tile clicks, updating the radio group selection if not disabled.
Added import and registration for the path_provider_foundation plugin in GeneratedPluginRegistrant.swift to enable path provider functionality on macOS. Also updated related dependencies in pubspec.lock.
Fix #4822
What's new
This PR adds three new CLI commands:
flet debug- to run Flet app on a device or emulator.flet devices- to list connected devices.flet emulators- to list iOS/Android emulators and manage Android emulators.How to use
Run this command to list all connected iOS/Android devices and emulators:
If you see empty list make sure emulator is running or device connected.
Copy device ID you'd like to run your app on.
Run the following command to build Flet app and run on your device:
Testing on Android emulator
To list available iOS and Android emulators run this command:
To create a new Android emulator run:
To start an emulator:
Testing on iOS/iPadOS emulator
To create a new iOS/iPadOS simulator:
List simulator models:
List available runtimes:
Create simulator:
For example:
Start Apple Simulator with:
Open "File -> Open Simulator -> .
Run this command to get simulator device ID:
Testing on a real iPhone/iPad device
pyproject.toml: