text
stringlengths
1
474
<topic_start>
Package directories
By default, DevTools limits the widgets displayed in the widget tree
to those from the project’s root directory, and those from Flutter. This
filtering only applies to the widgets in the Inspector Widget Tree (left side
of the Inspector) – not the Widget Details Tree (right side of the Inspector
in the same tab view as the Layout Explorer). In the Widget Details Tree, you
will be able to see all widgets in the tree from all packages.In order to show other widgets, a parent directory of theirs must be added to the Package Directories.For example, consider the following directory structure:Running your app from project_foo_app displays only widgets from
project_foo/pkgs/project_foo_app in the widget inspector tree.To show widgets from widgets_A in the widget tree,
add project_foo/pkgs/widgets_A to the package directories.To display all widgets from your project root in the widget tree,
add project_foo to the package directories.Changes to your package directories persist the next time the
widget inspector is opened for the app.<topic_end>
<topic_start>
Other resources
For a demonstration of what’s generally possible with the inspector,
see the DartConf 2018 talk demonstrating the IntelliJ version
of the Flutter inspector.To learn how to visually debug layout issues
using DevTools, check out a guided
Flutter Inspector tutorial.
<topic_end>
<topic_start>Using the Performance view
info Note
The DevTools performance view works for Flutter mobile and desktop apps.
For web apps, Flutter adds timeline events to the
performance panel of Chrome DevTools instead.
To learn about profiling web apps, check out Debugging web performance.The performance page can help you diagnose performance
problems and UI jank in your application.
This page offers timing and performance information
for activity in your application.
It consists of several tools to help you identify
the cause of poor performance in your app:Use a profile build of your application to analyze performance.
Frame rendering times aren’t indicative of release performance
when running in debug mode. Run your app in profile mode,
which still preserves useful debugging information.The performance view also supports importing and exporting of
data snapshots. For more information,
check out the Import and export section.<topic_end>
<topic_start>
What is a frame in Flutter?
Flutter is designed to render its UI at 60 frames per second
(fps), or 120 fps on devices capable of 120Hz updates.
Each render is called a frame.
This means that, approximately every 16ms, the UI updates
to reflect animations or other changes to the UI. A frame
that takes longer than 16ms to render causes jank
(jerky motion) on the display device.<topic_end>
<topic_start>
Flutter frames chart
This chart contains Flutter frame information for your application.
Each bar set in the chart represents a single Flutter frame.
The bars are color-coded to highlight the different portions
of work that occur when rendering a Flutter frame: work from
the UI thread and work from the raster thread.This chart contains Flutter frame timing information for your
application. Each pair of bars in the chart represents a single
Flutter frame. Selecting a frame from this chart updates the data
that is displayed below in the Frame analysis tab
or the Timeline events tab.
(As of DevTools 2.23.1, the Raster stats
is a standalone feature without data per frame).The flutter frames chart updates when new frames
are drawn in your app. To pause updates to this chart,
click the pause button to the right of the chart.
This chart can be collapsed to provide more viewing space
for data below by clicking the Flutter frames button above the chart.The pair of bars representing each Flutter frame are color-coded
to highlight the different portions of work that occur when rendering
a Flutter frame: work from the UI thread and work from the raster thread.<topic_end>
<topic_start>
UI
The UI thread executes Dart code in the Dart VM. This includes
code from your application as well as the Flutter framework.
When your app creates and displays a scene, the UI thread creates
a layer tree, a lightweight object containing device-agnostic
painting commands, and sends the layer tree to the raster thread
to be rendered on the device. Do not block this thread.<topic_end>
<topic_start>
Raster
The raster thread executes graphics code from the Flutter Engine.
This thread takes the layer tree and displays it by talking to
the GPU (graphic processing unit). You can’t directly access
the raster thread or its data, but if this thread is slow,
it’s a result of something you’ve done in the Dart code.
Skia, the graphics library, runs on this thread.
Impeller also uses this thread.Sometimes a scene results in a layer tree that is easy to construct,
but expensive to render on the raster thread. In this case, you
need to figure out what your code is doing that is causing
rendering code to be slow. Specific kinds of workloads are more
difficult for the GPU. They might involve unnecessary calls to
saveLayer(), intersecting opacities with multiple objects,
and clips or shadows in specific situations.For more information on profiling, check out
Identifying problems in the GPU graph.<topic_end>
<topic_start>
Jank (slow frame)
The frame rendering chart shows jank with a red overlay.
A frame is considered to be janky if it takes more than
~16 ms to complete (for 60 FPS devices). To achieve a frame rendering rate of
60 FPS (frames per second), each frame must render in
~16 ms or less. When this target is missed, you may
experience UI jank or dropped frames.For more information on how to analyze your app’s performance,
check out Flutter performance profiling.<topic_end>
<topic_start>
Shader compilation
Shader compilation occurs when a shader is first used in your Flutter