text
stringlengths
1
474
<topic_start>Attach to the Dart VM in VS Code
To open the command palette, go to
View >
Command Palette…You can also press Cmd + Shift + P.Type debug.Click the Debug: Attach to Flutter on Device command.In the Paste an VM Service URI box, paste the URI you copied
from Xcode and press Enter.<topic_end>
<topic_start>
Debug Dart and macOS code using Xcode
To debug macOS code, you need a Flutter app that contains macOS code.
In this section, you learn to connect two debuggers to your app:
Flutter via VS Code and Xcode. You need to run both VS Code and Xcode.These section uses the same example Flutter url_launcher app created
in Update test Flutter app.<topic_end>
<topic_start>Build the macOS version of the Flutter app in the Terminal
To generate the needed macOS platform dependencies,
run the flutter build command.<topic_end>
<topic_start>Start debugging with VS Code first
<topic_end>
<topic_start>Start the debugger in VS Code
To open the Flutter app directory, go to
File >
Open Folder… and choose the my_app directory.Open the lib/main.dart file.If you can build an app for more than one device,
you must select the device first.Go to
View >
Command Palette…You can also press Ctrl / Cmd +
Shift + P.Type flutter select.Click the Flutter: Select Device command.Choose your target device.Click the debug icon
().
This opens the Debug pane and launches the app.
Wait for the app to launch on the device and for the debug pane to
indicate Connected.
The debugger takes longer to launch the first time.
Subsequent launches start faster.This Flutter app contains two buttons:<topic_end>
<topic_start>Attach to the Flutter process in Xcode
To attach to the Flutter app, go to
Debug >
Attach to Process >
Runner.Runner should be at the top of the Attach to Process menu
under the Likely Targets heading.<topic_end>
<topic_start>Start debugging with Xcode first
<topic_end>
<topic_start>Start the debugger in Xcode
Open macos/Runner.xcworkspace from your Flutter app directory.Run this Runner as a normal app in Xcode.When the run completes, the Debug area at the bottom of Xcode displays
a message with the Dart VM service URI. It resembles the following response:Copy the Dart VM service URI.<topic_end>
<topic_start>Attach to the Dart VM in VS Code
To open the command palette, go to View > Command Palette…You can also press Cmd + Shift + P.Type debug.Click the Debug: Attach to Flutter on Device command.In the Paste an VM Service URI box, paste the URI you copied
from Xcode and press Enter.<topic_end>
<topic_start>
Debug Dart and C++ code using Visual Studio
To debug C++ code, you need a Flutter app that contains C++ code.
In this section, you learn to connect two debuggers to your app:
Flutter via VS Code and Visual Studio.
You need to run both VS Code and Visual Studio.These section uses the same example Flutter url_launcher app created
in Update test Flutter app.<topic_end>
<topic_start>Build the Windows version of the Flutter app in PowerShell or the Command Prompt
To generate the needed Windows platform dependencies,
run the flutter build command.<topic_end>
<topic_start>Start debugging with VS Code first
If you use VS Code to debug most of your code, start with this section.<topic_end>
<topic_start>Start the debugger in VS Code
To open the Flutter app directory, go to
File >
Open Folder… and choose the my_app directory.Open the lib/main.dart file.If you can build an app for more than one device,
you must select the device first.Go to
View >
Command Palette…You can also press Ctrl / Cmd +
Shift + P.Type flutter select.Click the Flutter: Select Device command.Choose your target device.Click the debug icon
().
This opens the Debug pane and launches the app.
Wait for the app to launch on the device and for the debug pane to
indicate Connected.
The debugger takes longer to launch the first time.
Subsequent launches start faster.This Flutter app contains two buttons:<topic_end>
<topic_start>Attach to the Flutter process in Visual Studio
To open the project solution file, go to
File >
Open >
Project/Solution…You can also press Ctrl + Shift + O.Choose the build/windows/my_app.sln file in your Flutter app directory.Go to Debug > Attach to Process.You can also press Ctrl + Alt + P.From the Attach to Process dialog box, choose my_app.exe.Visual Studio starts monitoring the Flutter app.<topic_end>
<topic_start>Start debugging with Visual Studio first
If you use Visual Studio to debug most of your code, start with this section.<topic_end>
<topic_start>Start the local Windows debugger
To open the project solution file, go to
File >
Open >
Project/Solution…You can also press Ctrl + Shift + O.Choose the build/windows/my_app.sln file in your Flutter app directory.Set my_app as the startup project.
In the Solution Explorer, right-click on my_app and select
Set as Startup Project.Click Local Windows Debugger to start debugging.You can also press F5.When the Flutter app has started, a console window displays
a message with the Dart VM service URI. It resembles the following response:Copy the Dart VM service URI.<topic_end>
<topic_start>Attach to the Dart VM in VS Code
To open the command palette, go to
View >
Command Palette…You can also press Cmd + Shift + P.Type debug.Click the Debug: Attach to Flutter on Device command.In the Paste an VM Service URI box, paste the URI you copied
from Visual Studio and press Enter.<topic_end>
<topic_start>
Resources
Check out the following resources on debugging Flutter, iOS, Android,
macOS and Windows:<topic_end>
<topic_start>
Flutter
<topic_end>
<topic_start>
Android
You can find the following debugging resources on