text
stringlengths 1
372
|
---|
dart runtimes and compilers support the combination of |
two critical features for flutter: a JIT-based fast |
development cycle that allows for shape changing and |
stateful hot reloads in a language with types, |
plus an Ahead-of-Time compiler that emits efficient |
ARM code for fast startup and predictable performance of |
production deployments. |
in addition, we have the opportunity to work closely |
with the dart community, which is actively investing |
resources in improving dart for use in flutter. for |
example, when we adopted dart, |
the language didn’t have an ahead-of-time |
toolchain for producing native binaries, |
which is instrumental in achieving predictable, |
high performance, but now the language does because the dart team |
built it for flutter. similarly, the dart VM has |
previously been optimized for throughput but the |
team is now optimizing the VM for latency, which is more |
important for flutter’s workload. |
dart scores highly for us on the following primary criteria: |
<topic_end> |
<topic_start> |
can flutter run any dart code? |
flutter can run dart code that doesn’t directly or |
transitively import dart:mirrors or dart:html. |
<topic_end> |
<topic_start> |
how big is the flutter engine? |
in march 2021, we measured the download size of a |
minimal flutter app (no material components, |
just a single center widget, built with flutter build |
apk --split-per-abi), bundled and compressed as a release APK, |
to be approximately 4.3 MB for ARM32, and 4.8 MB for ARM64. |
on ARM32, the core engine is approximately 3.4 MB |
(compressed), the framework + app code is approximately |
765 KB (compressed), the LICENSE file is 58 KB |
(compressed), and necessary java code (classes.dex) |
is 120 KB (compressed). |
in ARM64, the core engine is approximately 4.0 MB |
(compressed), the framework + app code is approximately |
659 KB (compressed), the LICENSE file is 58 KB |
(compressed), and necessary java code (classes.dex) |
is 120 KB (compressed). |
these numbers were measured using apkanalyzer, |
which is also built into android studio. |
on iOS, a release IPA of the same app has a download |
size of 10.9 MB on an iPhone x, as reported by apple’s |
app store connect. the IPA is larger than the APK mainly |
because apple encrypts binaries within the IPA, making the |
compression less efficient (see the |
iOS app store specific considerations |
section of apple’s QA1795). |
info note |
the release engine binary used to include LLVM IR (bitcode). |
however, apple deprecated bitcode in xcode 14 and removed support, |
so it has been removed from the flutter 3.7 release. |
of course, we recommend that you measure your own app. |
to do that, see measuring your app’s size. |
<topic_end> |
<topic_start> |
how does flutter define a pixel? |
flutter uses logical pixels, |
and often refers to them merely as “pixels”. |
flutter’s devicePixelRatio expresses the ratio |
between physical pixels and logical CSS pixels. |
<topic_end> |
<topic_start> |
capabilities |
<topic_end> |
<topic_start> |
what kind of app performance can i expect? |
you can expect excellent performance. flutter is |
designed to help developers easily achieve a constant 60fps. |
flutter apps run using natively compiled code—no |
interpreters are involved. |
this means that flutter apps start quickly. |
<topic_end> |
<topic_start> |
what kind of developer cycles can i expect? how long between edit and refresh? |
flutter implements a hot reload developer cycle. you can expect |
sub-second reload times, on a device or an emulator/simulator. |
flutter’s hot reload is stateful so the app state |
is retained after a reload. this means you can quickly iterate |
on a screen deeply nested in your app, without starting |
from the home screen after every reload. |
<topic_end> |
<topic_start> |
how is hot reload different from hot restart? |
hot reload works by injecting updated source code files |
into the running dart VM (virtual machine). this doesn’t |
only add new classes, but also adds methods and fields |
to existing classes, and changes existing functions. |
hot restart resets the state to the app’s initial state. |
for more information, see hot reload. |
<topic_end> |
<topic_start> |
where can i deploy my flutter app? |
you can compile and deploy your flutter app to iOS, android, |
web, and desktop. |
<topic_end> |
Subsets and Splits