text
stringlengths 1
474
|
|---|
folder of your project (the one containing pubspec.yaml)
|
in VS Code and clicking Run > Start Debugging (F5).<topic_end>
|
<topic_start>
|
Launch DevTools
|
Once the debug session is active and the application has started,
|
the Open DevTools commands become available in the
|
VS Code command palette (F1):The chosen tool will be opened embedded inside VS Code.You can choose to have DevTools always opened in a browser with the
|
dart.embedDevTools setting, and control whether it opens as a full window or
|
in a new column next to your current editor with the dart.devToolsLocation
|
setting.A full list of Dart/Flutter settings are available
|
here or in the
|
VS Code settings editor.
|
Some recommendation settings for Dart/Flutter in VS Code can be found
|
here.You can also see whether DevTools is running and launch it in a browser from the
|
language status area (the {} icon next to Dart in the status bar).
|
<topic_end>
|
<topic_start>Install and run DevTools from the command line
|
To run Dart DevTools from the CLI, you must have dart on your path. Then
|
you can run the following command to launch DevTools:To upgrade DevTools, upgrade your Dart SDK. If a newer Dart SDK
|
includes a newer version of DevTools, dart devtools will automatically
|
launch this version. If which dart points to the Dart SDK included in
|
your Flutter SDK, then DevTools will be upgraded when you upgrade your
|
Flutter SDK to a newer version.When you run DevTools from the command line, you should see output that
|
looks something like:<topic_end>
|
<topic_start>
|
Start an application to debug
|
Next, start an app to connect to.
|
This can be either a Flutter application
|
or a Dart command-line application.
|
The command below specifies a Flutter app:You need to have a device connected, or a simulator open,
|
for flutter run to work. Once the app starts, you’ll see a
|
message in your terminal that looks like the following:Open the DevTools instance connected to your app
|
by opening the second link in Chrome.This URL contains a security token,
|
so it’s different for each run of your app.
|
This means that if you stop your application and re-run it,
|
you need to connect to DevTools again with the new URL.<topic_end>
|
<topic_start>
|
Connect to a new app instance
|
If your app stops running
|
or you opened DevTools manually,
|
you should see a Connect dialog:You can manually connect DevTools to a new app instance
|
by copying the Observatory link you got from running your app,
|
such as http://127.0.0.1:52129/QjqebSY4lQ8=/
|
and pasting it into the connect dialog:
|
<topic_end>
|
<topic_start>Using the Flutter inspector
|
info Note
|
The inspector works with all Flutter applications.<topic_end>
|
<topic_start>
|
What is it?
|
The Flutter widget inspector is a powerful tool for visualizing and
|
exploring Flutter widget trees. The Flutter framework uses widgets
|
as the core building block for anything from controls
|
(such as text, buttons, and toggles),
|
to layout (such as centering, padding, rows, and columns).
|
The inspector helps you visualize and explore Flutter widget
|
trees, and can be used for the following:<topic_end>
|
<topic_start>
|
Get started
|
To debug a layout issue, run the app in debug mode and
|
open the inspector by clicking the Flutter Inspector
|
tab on the DevTools toolbar.info Note
|
You can still access the Flutter inspector directly from
|
Android Studio/IntelliJ, but you might prefer the
|
more spacious view when running it from DevTools
|
in a browser.<topic_end>
|
<topic_start>
|
Debugging layout issues visually
|
The following is a guide to the features available in the
|
inspector’s toolbar. When space is limited, the icon is
|
used as the visual version of the label.<topic_end>
|
<topic_start>
|
Inspecting a widget
|
You can browse the interactive widget tree to view nearby
|
widgets and see their field values.To locate individual UI elements in the widget tree,
|
click the Select Widget Mode button in the toolbar.
|
This puts the app on the device into a “widget select” mode.
|
Click any widget in the app’s UI; this selects the widget on the
|
app’s screen, and scrolls the widget tree to the corresponding node.
|
Toggle the Select Widget Mode button again to exit
|
widget select mode.When debugging layout issues, the key fields to look at are the
|
size and constraints fields. The constraints flow down the tree,
|
and the sizes flow back up. For more information on how this works,
|
see Understanding constraints.<topic_end>
|
<topic_start>
|
Flutter Layout Explorer
|
The Flutter Layout Explorer helps you to better understand
|
Flutter layouts.For an overview of what you can do with this tool, see
|
the Flutter Explorer video:You might also find the following step-by-step article useful:<topic_end>
|
<topic_start>
|
Using the Layout Explorer
|
From the Flutter Inspector, select a widget. The Layout Explorer
|
supports both flex layouts and fixed size layouts, and has
|
specific tooling for both kinds.<topic_end>
|
<topic_start>Flex layouts
|
When you select a flex widget (for example, Row, Column, Flex)
|
or a direct child of a flex widget, the flex layout tool will
|
appear in the Layout Explorer.The Layout Explorer visualizes how Flex widgets and their
|
children are laid out. The explorer identifies the main axis
|
and cross axis, as well as the current alignment for each
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.