Questions tagged [dart-isolates]

In the Dart programming language, an Isolate is a single-threaded unit of concurrency.

In the Dart programming language, an Isolate is a single-threaded unit of concurrency. Communication with others Isolates is done via message passing.

Introduktion to Dart Isolate

dart:isolate library

296 questions
5
votes
1 answer

Dart: how to specify an Isolate URI in an imported package?

I have written some code and I want to provide it in a package, but I want to also expose it to package consumers as a worker. For this purpose I have created a wrapper class, that runs an isolate internally and using the send command and listeners…
Peter StJ
  • 2,297
  • 3
  • 21
  • 29
5
votes
2 answers

What is the best way to track the state of an Isolate in Dart?

I'm trying to track whether the isolate is currently running or not (and in the future whether it has errored out) using isolate.addOnExitListener(...). However, the following snippet of code is not working how I would expect: items.forEach((name,…
Jim Simon
  • 388
  • 2
  • 9
5
votes
2 answers

Shared memory between Isolates using IndexedDB

I'm working with Isolates right now and wanted to know if using IndexedDB to share data between Isolates is a good way to communicate? Specifically, I want one Isolate to be able to write to it, then tell the other Isolates they may readonly it.…
Austin Salgat
  • 416
  • 5
  • 13
5
votes
1 answer

Recent documentation about Dart Isolates

I recently started with Dart (www.dartlang.org) and really like it so far. A very promising feature are isolates, but I am not sure on how to start. The documentation I found so far is from before a breaking change (BREAKING CHANGE: dart:isolate) in…
Hendrik Jan
  • 4,396
  • 8
  • 39
  • 75
5
votes
4 answers

Is there any example for dart's `spawnUri(...)` in library "dart:isolate"?

There is a spawnUri(uri) function in dart:isolate, but I don't find any example. I have guessed its usage, but failed. Suppose there are 2 files, in the first one, it will call spawnUri for the 2nd one, and communicate with it. first.dart import…
Freewind
  • 193,756
  • 157
  • 432
  • 708
4
votes
0 answers

Flutter - Main thread still hangs even when running heavy computations on seperate isolates

I am generating a list of a thousand items from an api response, this would hang my main thread so I seperated this task to five seperate isolates using the compute() method, where each isolate generates a part of the list,each containing 200 items.…
4
votes
0 answers

flutter Timer app - isolate not working in ios real devices

I am currently working on a timer app in flutter and use Dart Isolate for the timer to work in background. It really works well in ios Simulator(iPhone 12 Pro) and android devices. In ios real devices, when the app is run in background, the timer…
4
votes
1 answer

How to get a reference to an already running isolate?

How do you get a reference to an already running isolate during the start of a Flutter app? Imagine a Futter app that performs all of its work in an Isolate. The Isolate can run for close to an hour even if the app is put into background (which btw.…
SePröbläm
  • 5,142
  • 6
  • 31
  • 45
4
votes
2 answers

Where Isolate can be defined in Flutter? How to start a thread in Flutter?

I am a new in Flutter, so the question can be kind of obvious, but I can't find any answer on the Internet. I have a Flutter application with some screens and I would say on the fifth screen I have a button, which should trigger some heavy…
mspnr
  • 416
  • 4
  • 12
4
votes
1 answer

Flutter: memory leak with isolate (compute)

I see memory leak every time I call compute() in my Flutter app, which is basically just a convenient way to spawn an isolate as far as I understand. My app memory footprint grows and never goes down after GC. I've reduced my code to just calling an…
Illya S
  • 161
  • 1
  • 12
4
votes
1 answer

Cannot pause Dart isolate

I wished to create an Isolate in Dart that I could pause and resume programmatically. This is the code that I used. import 'dart:io'; import 'dart:isolate'; void main() async { print("Starting isolate"); Isolate isolate; ReceivePort…
Ashutosh Singh
  • 1,107
  • 17
  • 28
4
votes
1 answer

How to instantiate local notifications on Isolate?

Background of my problem: I am developing a Flutter app that performs a repeated background activity every few hours and notifies the user if there are any updates. Currently, I have created an isolate function that is able to perform the background…
4
votes
1 answer

How much maximum memory in a separate isolate in dart

I am learning about isolate in dart/flutter, in almost documents say that isolates don't share memory each other, but it not say how much maximum memory in an isolate. Is it limited by App maximum memory or each isolate have a separate memory space…
Khánh Vũ Đỗ
  • 895
  • 1
  • 7
  • 13
4
votes
3 answers

Dart - getting 'Malformed message' in console when spawning multiple isolates

i'm new to dart and i'm trying to run multiple algorithms using isolates to more efficiently run them multiple times, however, when calling more than one function with Isolate.spawn i start getting 'Malformed message' in the console, it still works,…
4
votes
1 answer

Process large number of tasks using Isolate

I have ~10k long-running tasks that I need to compute sequentially. I decided to use Isolates for this purpose. Question is should I create spawn Isolate every time for each individual task or Should I create only one Isolate for all the tasks'…
Anil8753
  • 2,663
  • 4
  • 29
  • 40