📱 Flutter Intermediate

What is an Isolate in Dart?

Answer

Dart is single-threaded, but you can achieve true parallelism using Isolates — independent workers that have their own memory heap and Dart event loop. Isolates do not share memory; they communicate by passing messages through ports. This design eliminates race conditions. Use isolates for CPU-intensive work like parsing large JSON, image processing, or complex computations that would otherwise freeze the UI. The simpler compute() function is a shortcut for spawning a one-off isolate and returning its result.