r/flutterhelp • • 1h ago

RESOLVED Flutter help

I recently learned about Dart isolates, and they are incredible for handling heavy workloads by running tasks on a separate isolate away from the main thread.

However, when we spawn a new isolate, does it actually create a new operating system thread? I am quite confused, as AI models keep agreeing with me that it conceptually creates a new thread without providing a definitive, underlying reason. Since Dart is fundamentally a single-threaded language where the main execution runs in a single isolate, does spawning a new isolate actually entail creating another thread under the hood? I would love to understand the precise mechanics of what happens at a lower level when a new isolate is spawned.

1 Upvotes

5 comments sorted by

2

u/svprdga 47m ago

Yes, a new thread is created separate from the main thread where Dart runs. The special particularity is that it has assigned a segment of memory independent of the main process.

2

u/SpellBig8198 17m ago

You should also know that there is a price to pay every time you spawn an isolate, so you should only do it when you really need it, e.g. when processing a large file or running a complex algorithm. Most of the time, you don't need isolates at all.

1

u/Solid-Exercise-225 13m ago

Yess I read it, major confusion was the new thread part

1

u/50u1506 59m ago

I think that is the case, I will Google or AI and get back to u lol