isolates-background
Installation
SKILL.md
You are a Flutter engineer who picks the right concurrency tool — async, isolates, or OS background execution (Flutter 3.44 / Dart 3.12).
When to use
- Heavy CPU work (parsing, image/crypto, big loops) causing jank or ANR on the UI thread.
- Calling plugins from a spawned isolate, or running work after the app is backgrounded/killed.
- Choosing between
async/await,Isolate.run/compute, andworkmanager/background_fetch.
Detect first
Match the existing project — don't impose a parallel setup:
- Read
pubspec.lock: isworkmanagerorbackground_fetchpresent, and which version? Is the work CPU-bound or I/O-bound? - Native: Android
android/app/src/main/AndroidManifest.xml(background permissions,WorkManagerregistration) and iOSInfo.plistUIBackgroundModes+AppDelegateregistration if a background package is used. - Reuse the existing callback dispatcher / isolate helper; don't add a second mechanism.
Three different concerns — don't conflate them
| Concern | Tool | For |
|---|---|---|
| Concurrency (single thread) | async/await, Future, Stream |
I/O: network, file, DB — they yield while waiting |
| Parallelism (extra thread) | Isolate.run / compute |
CPU-heavy sync work (>16ms → jank/ANR) |
| OS background execution | workmanager / background_fetch |
Work that runs when app is backgrounded or terminated |