While your app grows bigger, you might not be surprised that it starts to run slower. The situation happens with some new features, related to heavy tasks such as decoding images with high resolution, computing complicated math, or reading large files. All of these result in one annoying thing — Jank.
This session in Google I/O 2022 reveals the mechanism of how Flutter keeps the app smooth with 60 fps, why it slows down, and how we can fix it.
Table Of Content
- Isolate and event loop
- Core libraries/system APIs
- Spawn an Isolate
- Compute Isolate — short-lived background tasks
- Worker Isolate — Long-lived background tasks - Recap
- References
Isolate and event loop
All the dart code runs in an isolate with an event loop. Each isolate has a single thread running an event loop, with a chunk of private memory. It is kinda like process
in Android. The event loop contains two queues: microtask queue
and event queue
. We won’t go into the…