text stringlengths 1 372 |
|---|
for a total of 16ms or less. |
if your frames are rendering in well under |
16ms total in profile mode, |
you likely don’t have to worry about performance |
even if some performance pitfalls apply, |
but you should still aim to build and |
render a frame as fast as possible. why? |
if you are wondering why 60fps leads to a smooth visual experience, |
check out the video why 60fps? |
<topic_end> |
<topic_start> |
pitfalls |
if you need to tune your app’s performance, |
or perhaps the UI isn’t as smooth as you expect, |
the DevTools performance view can help! |
also, the flutter plugin for your IDE might |
be useful. in the flutter performance window, |
enable the show widget rebuild information check box. |
this feature helps you detect when frames are |
being rendered and displayed in more than 16ms. |
where possible, |
the plugin provides a link to a relevant tip. |
the following behaviors might negatively impact |
your app’s performance. |
avoid using the opacity widget, |
and particularly avoid it in an animation. |
use AnimatedOpacity or FadeInImage instead. |
for more information, check out |
performance considerations for opacity animation. |
when using an AnimatedBuilder, |
avoid putting a subtree in the builder |
function that builds widgets that don’t |
depend on the animation. this subtree is |
rebuilt for every tick of the animation. |
instead, build that part of the subtree |
once and pass it as a child to |
the AnimatedBuilder. for more information, |
check out performance optimizations. |
avoid clipping in an animation. |
if possible, pre-clip the image before animating it. |
avoid using constructors with a concrete list |
of children (such as column() or ListView()) |
if most of the children are not visible |
on screen to avoid the build cost. |
avoid overriding operator == on widget objects. |
while it might seem like it would help by avoiding unnecessary rebuilds, |
in practice it hurts performance because it results in O(N²) behavior. |
the only exception to this rule is leaf widgets (widgets with no children), |
in the specific case where comparing the properties of the widget |
is likely to be significantly more efficient than rebuilding the widget |
and where the widget will rarely change configuration. |
even in such cases, |
it is generally preferable to rely on caching the widgets, |
because even one override of operator == |
can result in across-the-board performance degradation |
as the compiler can no longer assume that the call is always static. |
<topic_end> |
<topic_start> |
resources |
for more performance info, check out the following resources: |
<topic_end> |
<topic_start> |
measuring your app's size |
many developers are concerned with the size of their compiled app. |
as the APK, app bundle, or IPA version of a flutter app is |
self-contained and holds all the code and assets needed to run the app, |
its size can be a concern. the larger an app, |
the more space it requires on a device, |
the longer it takes to download, |
and it might break the limit of useful |
features like android instant apps. |
<topic_end> |
<topic_start> |
debug builds are not representative |
by default, launching your app with flutter run, |
or by clicking the play button in your IDE |
(as used in test drive and |
write your first flutter app), |
generates a debug build of the flutter app. |
the app size of a debug build is large due to |
the debugging overhead that allows for hot reload |
and source-level debugging. as such, it is not representative of a production |
app end users download. |
<topic_end> |
<topic_start> |
checking the total size |
a default release build, such as one created by flutter build apk or |
flutter build ios, is built to conveniently assemble your upload package |
to the play store and app store. as such, they’re also not representative of |
your end-users’ download size. the stores generally reprocess and split |
your upload package to target the specific downloader and the downloader’s |
hardware, such as filtering for assets targeting the phone’s DPI, filtering |
native libraries targeting the phone’s CPU architecture. |
<topic_end> |
<topic_start> |
estimating total size |
to get the closest approximate size on each platform, use the following |
instructions. |
<topic_end> |
<topic_start> |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.