# Eliminating UI Jank: Flutter Concurrency with Isolate & Compute — Luthfi Arifin

> Explore isolates and compute functions to optimize Flutter UI performance and responsiveness. Flutter promises smooth animation, until a heavy computation…

Canonical page: https://luthfiarifin.com/articles/flutter-isolates-compute-ui-jank
Last updated: 2026-11-29

- **Topic:** Flutter
- **Published:** Level Up Coding, Jan 23, 2024
- **Reading time:** 6 min read
- **Full article:** [levelup.gitconnected.com/eliminating-ui-jank-flutter-concurrency-with-isolate-and-compute-e9fdb0d5ca36](https://levelup.gitconnected.com/eliminating-ui-jank-flutter-concurrency-with-isolate-and-compute-e9fdb0d5ca36)
- **Tags:** Flutter, Dart, Isolates, Concurrency, Performance

*Explore isolates and compute functions to optimize Flutter UI performance and responsiveness.*

## Overview

Flutter promises smooth animation, until a heavy computation lands on the main thread and the UI stutters. This piece explains why that jank happens (work that overruns a frame’s time budget blocks the event loop and delays the next repaint) and how Dart’s isolates fix it by running that work in parallel, in memory of their own.

It compares the two tools for the job: *Isolate.spawn*, for long-lived workers that exchange many messages through ports, and *compute*, a one-call wrapper for a single expensive function. It also clears up a common confusion: async/await keeps code from blocking while it waits, but it still runs on one thread, so it does not make CPU-heavy work parallel.

## Key takeaways

- Jank is a frame’s work overrunning its time budget on the main isolate.
- Isolates run in parallel with separate memory and talk only through messages.
- Use Isolate.spawn for long-lived workers with frequent messaging; use compute for a single expensive call.
- async/await is not parallelism: it avoids waiting on I/O, but runs on the same thread.

## Figures

- [Jank: work on the main isolate overruns the frame budget](https://luthfiarifin.com/images/articles/flutter-isolates-compute-ui-jank-1.webp) — Event-loop diagram: a long tap handler on the main isolate runs past the frame gap and delays the repaint.
- [The expensive callback moved to a spawned isolate](https://luthfiarifin.com/images/articles/flutter-isolates-compute-ui-jank-2.webp) — Event-loop diagram: the expensive callback runs in a spawned isolate and returns its result to the main isolate.
- [Before: the spinner freezes](https://luthfiarifin.com/images/articles/flutter-isolates-compute-ui-jank-3.webp) — Screen recording of a Flutter demo app whose loading spinner freezes while heavy work runs on the main isolate.
- [After: heavy work in an isolate, the UI stays smooth](https://luthfiarifin.com/images/articles/flutter-isolates-compute-ui-jank-4.webp) — Screen recording of the same demo app whose spinner keeps turning while the heavy work runs in an isolate.

## Resources

- [luthfiarifin/flutter_concurrency_workout](https://github.com/luthfiarifin/flutter_concurrency_workout) — Sample code
- [Concurrency and isolates](https://docs.flutter.dev/perf/isolates) — Flutter docs
- [Async vs Isolates | Decoding Flutter](https://youtu.be/5AxWC49ZMzs) — YouTube
