Flutter & Dart : What is an isolate in flutter?

967 Views Asked by At

As I study about flutter, I notices that there is a thing called isolate.

What is it for? And how do we implement that? Can you give me a simple example?

Thank you in advance.

1

There are 1 best solutions below

0
On

Isolate in flutter, similar with threading.

"Flutter is single-threaded but it is capable of doing multi-threading stuff using Isolates (many processes). When Dart starts, there will be one main Isolate(Thread). This is the main executing thread of the application, also referred to as the UI Thread. In simple Flutter apps you will only ever use one Isolate, and your app will run smoothly. Isolates are:

Dart’s version of Threads. Do not share memory between each other. Uses Ports and Messages to communicate between them. May use another processor core if available. Runs code in parallel."

Docs & Simple Example

"Concurrent programming using isolates: independent workers that are similar to threads but don't share memory, communicating only via messages."

Official Docs