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
3
votes
2 answers

Flutter can you "send" objects as a message with compute()?

So I basically have a simple class with a update() method. But because that update() method makes some math, I wanted to use compute() to make it run in another Isolate. The plan was to run the update() method in the Isolate and return the updated…
Quasi
  • 576
  • 4
  • 13
3
votes
1 answer

How to call a platform code from an isolate in flutter?

I know these libraries flutter_isolate and isolate_handler exist that support doing these but I couldn't find any method to call platform specific codes from inside of them. Can someone show any example of how it's done ?
xyron
  • 75
  • 1
  • 2
  • 6
3
votes
1 answer

Flutter, Moor and WorkManager

I am developing a flutter application (at the time just for Android, but with iOS support planned for later). The application operates in two ways: Flutter UI with most of the business logic (Foreground isolate, started with the main method)…
Martin Hlavňa
  • 648
  • 7
  • 20
3
votes
1 answer

two isolate send message by the port will drop some messges of dart 2.5 version

if I send message from one isolate to the main one, the main can't receive the full message. my test code is blew: import 'package:flutter/material.dart'; import 'dart:isolate'; import 'dart:async'; void main() { init(); …
ping.wu
  • 31
  • 3
3
votes
0 answers

How to run task in background even if the app is closed and get the latest result generated by the task and display it when app is opened?

I want to to create a step counter app in flutter so i used Flutter pedometer plugin and it worked perfectly, but i want to run this plugin every time to calculate user steps even if the main app is closed . I found that i can use dart isolates to…
a7me63azza8
  • 437
  • 3
  • 10
3
votes
1 answer

Getting Geolocation in a Secondary Isolate as a background task in a Flutter App

I want to fetch the GeoLocation of a device, in background, even when the app is terminated. Flutter provides Isolates, along with AlarmManager, as a way to do so. My end-goal, again, is to get GeoLocation of a device even when the application has…
user3279692
  • 329
  • 2
  • 13
3
votes
1 answer

Dart / Flutter: async behaviour of an Isolate's top level function

Aye Aye good people, I'm experiencing a weird behavior when using the top level function of an isolate asynchronously; you can find example code HERE, but in short as top level function of an isolate this works: String _syncHandle(int data) { …
Francesco Iapicca
  • 2,618
  • 5
  • 40
  • 85
3
votes
2 answers

Execute sqflite operation on separate isolate in flutter and synchronously

I am trying to execute sqflite operation in compute to run in another isolate and the result is returned should show in listview builder so I need to create it sync, but in my case the sqflite operation run at last after listview builder…
Vidhey
  • 27
  • 2
3
votes
1 answer

Flutter heavy platform code causes UI lag

I'm using MethodChannel.invoke to call some platform code to return app icons as Uint8Lists. This happens for a list of all the apps on a device (can be quite a lot), displayed as FutureBuilders in a ListView.builder. This caused a lot of stutter…
Lucas
  • 2,472
  • 2
  • 18
  • 33
3
votes
3 answers

Why does creating a single ReceiverPort cause the Dart VM to hang?

e.g.: import 'dart:isolate'; void main() { var p = new ReceivePort(); } This will make the whole VM hang until I Ctrl-C it. Why is this?
kirbyfan64sos
  • 10,377
  • 6
  • 54
  • 75
3
votes
0 answers

What is the memory overhead of spawning a Dart isolate?

I've read that the memory overhead for spawning a Dart isolate is ~2.5mb. However, the source for that number is a dartlang.org Google Group discussion, not an official doc. Plus, I can't find the page anymore, I can only find a cached version of it…
user3485775
  • 141
  • 3
3
votes
1 answer

Dart pass TCP ServerSocket client to Isolate

On Quora Seth Ladd once said: Consider the possibility of accepting new connections and giving them to isolates for doing the work. As of today, you can pass sockets to other isolates (by reference) and scale up linearly. I tried to accomplish…
Krzysztof Wende
  • 3,208
  • 25
  • 38
3
votes
1 answer

Improve application performance with isolate

I have an application that generate hashed password and to generate it takes time. I think to improve performance, I would let hashed password generator work in a seperate core. My computer support 3 core processors and I think it is a good idea to…
softshipper
  • 32,463
  • 51
  • 192
  • 400
3
votes
2 answers

how to spawn a new Isolate in dart?

Is something going on wth Dart isolates at present? looking at a few past stackoverflow questions most people looked to be using spawnIsolate or spawnFunction to start a new isolate running, but those methods don't appear to exist any more, nor is…
Daniel Robinson
  • 13,806
  • 18
  • 64
  • 112
3
votes
1 answer

dart vm send back stream from isolate

there is similar question (how to process a HTTP stream with Dart) about processing streams in dart2js. I am focused on vm. I can read from spec that: The content of message can be: primitive values (null, num, bool, double, String), instances of…
kamiseq
  • 593
  • 4
  • 17