text
stringlengths 1
372
|
|---|
click open.
|
error important
|
do not use the new > project from existing sources
|
option for flutter projects.
|
<topic_end>
|
<topic_start>
|
editing code and viewing issues
|
the flutter plugin performs code analysis that enables the following:
|
<topic_end>
|
<topic_start>
|
running and debugging
|
info note
|
you can debug your app in a few ways.
|
the instructions below describe features available in android
|
studio and IntelliJ. for information on launching DevTools,
|
see running DevTools from android studio in the
|
DevTools docs.
|
running and debugging are controlled from the main toolbar:
|
<topic_end>
|
<topic_start>
|
selecting a target
|
when a flutter project is open in the IDE, you should see a set of
|
flutter-specific buttons on the right-hand side of the toolbar.
|
info note
|
if the run and debug buttons are disabled, and no targets are listed,
|
flutter has not been able to discover any connected iOS or
|
android devices or simulators.
|
you need to connect a device, or start a simulator, to proceed.
|
<topic_end>
|
<topic_start>
|
run app without breakpoints
|
<topic_end>
|
<topic_start>
|
run app with breakpoints
|
<topic_end>
|
<topic_start>
|
fast edit and refresh development cycle
|
flutter offers a best-in-class developer cycle enabling you to see the effect
|
of your changes almost instantly with the stateful hot reload feature.
|
to learn more, check out hot reload.
|
<topic_end>
|
<topic_start>
|
show performance data
|
info note
|
to examine performance issues in flutter, see the
|
timeline view.
|
to view the performance data, including the widget rebuild
|
information, start the app in debug mode, and then open
|
the performance tool window using
|
view > tool windows > flutter performance.
|
to see the stats about which widgets are being rebuilt, and how often,
|
click show widget rebuild information in the performance pane.
|
the exact count of the rebuilds for this frame displays in the second
|
column from the right. for a high number of rebuilds, a yellow spinning
|
circle displays. the column to the far right shows how many times a
|
widget was rebuilt since entering the current screen.
|
for widgets that aren’t rebuilt, a solid grey circle displays.
|
otherwise, a grey spinning circle displays.
|
the app shown in this screenshot has been designed to deliver
|
poor performance, and the rebuild profiler gives you a clue
|
about what is happening in the frame that might cause poor
|
performance. the widget rebuild profiler is not a diagnostic
|
tool, by itself, about poor performance.
|
the purpose of this feature is to make you aware when widgets are
|
rebuilding—you might not realize that this is happening when just
|
looking at the code. if widgets are rebuilding that you didn’t expect,
|
it’s probably a sign that you should refactor your code by splitting
|
up large build methods into multiple widgets.
|
this tool can help you debug at least four common performance issues:
|
the whole screen (or large pieces of it) are built by a single
|
StatefulWidget, causing unnecessary UI building. split up the
|
UI into smaller widgets with smaller build() functions.
|
offscreen widgets are being rebuilt. this can happen, for example,
|
when a ListView is nested in a tall column that extends offscreen.
|
or when the RepaintBoundary is not set for a list that extends
|
offscreen, causing the whole list to be redrawn.
|
the build() function for an AnimatedBuilder draws a subtree that
|
does not need to be animated, causing unnecessary rebuilds of static
|
objects.
|
an opacity widget is placed unnecessarily high in the widget tree.
|
or, an opacity animation is created by directly manipulating the
|
opacity property of the opacity widget, causing the widget itself
|
and its subtree to rebuild.
|
you can click on a line in the table to navigate to the line
|
in the source where the widget is created. as the code runs,
|
the spinning icons also display in the code pane to help you
|
visualize which rebuilds are happening.
|
note that numerous rebuilds doesn’t necessarily indicate a problem.
|
typically you should only worry about excessive rebuilds if you have
|
already run the app in profile mode and verified that the performance
|
is not what you want.
|
and remember, the widget rebuild information is only available in
|
a debug build. test the app’s performance on a real device in a profile
|
build, but debug performance issues in a debug build.
|
<topic_end>
|
<topic_start>
|
editing tips for flutter code
|
if you have additional tips we should share, let us know!
|
<topic_end>
|
<topic_start>
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.