Build and debug Flutter iOS apps on Windows
Build the iOS app on Windows and debug on your iPhone, with native breakpoints plus Dart breakpoints and hot reload.
Build the iOS side of a Flutter project on Windows and debug it on your iPhone. Native and Dart breakpoints both work, and so does hot reload. Use KXBuild in place of flutter build ios and flutter run for iOS. Every other flutter command works as usual.
Steps
Install Flutter and the VS Code extension
Install the Flutter SDK as described on the Flutter website and add the flutter command to PATH. Open a new terminal and check that this prints a version. Then install the Flutter extension from the VS Code Marketplace, which installs the Dart extension too.
> flutter --versionCreate a project
To use an existing project, open the Flutter project's root folder in VS Code with File > Open Folder…, or drag the folder into VS Code. Otherwise, create one with flutter create or one of the options below.
Use either of these
-
VS Code extension
Run KXBuild: New Project from the Command Palette and pick the "Flutter App" template.
-
Command line
> kxbuild project create -t flutter_app -n myflutterapp -o D:\work
Run doctor
Do this first whenever you open a project for the first time. Doctor checks your Flutter setup and prepares the iOS project.
Use either of these
-
VS Code extension
In the title bar of the KXBuild view, open the ··· menu and run Doctor (fix environment).
-
Command line
> kxbuild doctor D:\work\myflutterapp
If the project uses plugins that need CocoaPods, install their dependencies in the ios folder after doctor. See CocoaPods. Otherwise, skip this.
ios> pod installWrite code
The Flutter extension provides completion, go to definition and error checking for Dart. KXBuild provides them for the Swift and Objective-C code under ios/.
Debug
Connect your iPhone over USB, select it in the KXBuild view and press F5. Native breakpoints hit first. Once the app starts, the Dart debugger attaches automatically, so Dart breakpoints and hot reload both work.
Release
Build with the Release configuration to get build\Runner.ipa in the ios folder. To upload it to App Store Connect, see Release and App Store submission.
Use either of these
-
VS Code extension
Switch the configuration to Release in the Build configuration node of the KXBuild view, then run KXBuild: Build from the Command Palette.
-
Command line
> kxbuild build .\ios\Runner.xcworkspace -c Release
Next steps
Build and configure
Debug versus Release, choosing a scheme, target and configuration, overriding build settings, where build products go, when you get an .ipa and when Swift package dependencies resolve.
Release and App Store submission
Build Release with a Distribution certificate to get an .ipa, upload it to App Store Connect with Transporter or Appuploader, then go through TestFlight and App Review. Ad Hoc and enterprise distribution work the same way.
Don't see your framework?
kxbuild is a general-purpose build toolchain, so if your framework produces an Xcode project, KXBuild can build it. The list above covers common cases only. Tell us about your setup.