Skip to content

Conversation

@FeodorFitsner
Copy link
Contributor

@FeodorFitsner FeodorFitsner commented Nov 28, 2025

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:

flet devices

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:

flet debug <ios|android> --device-id <device_id> --template-ref 0.70.0 -v

Testing on Android emulator

To list available iOS and Android emulators run this command:

flet emulators

This command requires Android SDK - you will be asked to install/update it.

To create a new Android emulator run:

flet emulators create my-emulator

To start an emulator:

flet emulators start my-emulator

Testing on iOS/iPadOS emulator

To create a new iOS/iPadOS simulator:

List simulator models:

xcrun simctl list devicetypes

List available runtimes:

xcrun simctl list runtimes

Create simulator:

xcrun simctl create "<Name>" "<Device Type>" "<Runtime>"

For example:

xcrun simctl create "My iPhone 17 Pro" "iPhone 17 Pro" com.apple.CoreSimulator.SimRuntime.iOS-26-1

Start Apple Simulator with:

open -a Simulator

Open "File -> Open Simulator -> .

Run this command to get simulator device ID:

flet devices

Testing on a real iPhone/iPad device

  • Enable developer mode on your device.
  • Connect the device with USB cable. You can use debug via Wi-Fi, but it's significantly slower than via cable.
  • Open XCode, go to "Window -> Devices and Simulators". Wait until "device support files" are copied - it could take a few minutes.

When you connect an iOS device and open Xcode, it automatically downloads “device support” and symbol files from the iPhone. These files allow Xcode (and Flutter) to understand the exact iOS version on the device and provide fast, reliable debugging. Without them, Xcode can’t map system libraries correctly, which leads to slow startup, missing breakpoints, or warnings like “LLDB could not find the on-disk shared cache.” This setup happens only once per iOS version and is required for running or debugging apps on a physical device.

  • Create a new provisioning profile that includes your device ID and developer certificate.
  • Configure app bundle ID and "debugging" profile in pyproject.toml:
[tool.flet.ios]
bundle_id = "com.your-company.app"

[tool.flet.ios.export_methods."debugging"]
provisioning_profile = "Development com.your-company.app"
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.
Copy link
Contributor

@sourcery-ai sourcery-ai bot left a 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

@Muddassir-Farooq-official

@FeodorFitsner @InesaFitsner

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?"

@FeodorFitsner
Copy link
Contributor Author

Yes, flet debug allows running on emulator or a real device without making IPA/APK package and manually uploading it to a device.

"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).

@Muddassir-Farooq-official

@FeodorFitsner any chance of stable release on v1 in December 2025

@FeodorFitsner
Copy link
Contributor Author

Absolutely! We are going to release a stable Flet v1 Beta before Xmas.

@Muddassir-Farooq-official

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...

@ndonkoHenri ndonkoHenri linked an issue Nov 29, 2025 that may be closed by this pull request
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.
@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Nov 29, 2025

Deploying flet-docs with  Cloudflare Pages  Cloudflare Pages

Latest commit: 34ac8ae
Status: ✅  Deploy successful!
Preview URL: https://e795168e.flet-docs.pages.dev
Branch Preview URL: https://flet-debug.flet-docs.pages.dev

View logs

Copy link
Contributor

Copilot AI left a 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/emulators
  • flet devices - lists connected iOS/Android devices
  • flet emulators - manages iOS/Android emulators

Key changes include:

  • Major code refactoring: extracting common functionality from build.py into new base classes (BaseFlutterCommand and BaseBuildCommand)
  • 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.

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants