Menu

Dart Async, Streams and Isolates, Measured on 3.11
📰

Dart Async, Streams and Isolates, Measured on 3.11

DEV Community: dart·t.labo·1 day ago
#UxjTg0Qo
#devtodart#devto#dev#future#await
Long article (4108 words) — no AI summary yet.
Reading 0:00
15s threshold

Series: Dart lecture 5/6 (advanced). For developers who already write Dart or Flutter code and have met at least one of these: a UI that freezes while JSON is parsed, a try/catch that did not catch, or Bad state: Stream has already been listened to . After this lecture you can predict the order in which async code runs, run independent calls in parallel, cancel streams properly, and move CPU work to an isolate only when it pays off.

If you build Flutter apps, this is the lecture that explains jank that a profiler shows but does not explain. Dart has one thread per isolate, and async does not change that: it only decides when code runs, not where . Every claim below is backed by a small program we ran, with its real output, including two errors we did not expect to hit while writing it.

Environment: Dart SDK 3.11.5 (stable), dart run (JIT) unless noted, Apple Silicon Mac (M1 Pro, 8 cores, 16 GB), macOS. Timings are the median of 3 runs.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.