Isolates (Flutter- Async Programming with Dart) — Part 1

Abdur Mohammed
2 min readJul 30, 2022

--

Part of Flutter/Dart Shorts: To the point| Simple.

1. Pre-requisites:

  • Basic understanding of
  • Threading.
  • Memory allocation.
  • Garbage collection.

2. Why is this important?

  • Contributes towards getting a better understanding of multi-threading and memory allocation in dart.

3. What is an isolate?

• Its is a place where dart runs all its code.

• Single-threaded.

• Separate memory.

• Separate event loop (More on this next week).

4. What if I need another thread?

• Create another isolate.

• Separate memory.

• Separate event loop.

5. Can a parent isolate directly access child isolate’s memory?

• No, hence the name isolate.

• If it wants to access the memory, it can do so through messages.

• The receiver isolate processes the messages using its event loop.

Communication between isolates.

6. What is the advantage of having separate memory per isolate?

  • Simpler Memory allocation and Garbage collection.
  • No locking is needed since there will be only one thread ever using it.

That’s all for this week. Next week- Event loops :-)

You can find me on

LinkedInhttps://www.linkedin.com/in/knowabdur
Twitter: — https://twitter.com/AbdurDeveloper

--

--

Abdur Mohammed

React Native| Flutter | Senior Software Engineer | Sydney, Australia