Questions tagged [isolate]

41 questions
0
votes
0 answers

Flutter background service get user location failed

My Flutter app requires fetching the user's current location after a periodic time even app is in the background or clear from recent. To run app in background mode I am using flutter_background_service. I have implemented the example and works fine…
Humayun Kabir
  • 561
  • 2
  • 13
  • 27
0
votes
0 answers

How to create a custom plugin registrant in flutter?

I am using the very nice flutter_isolate package together with just_audio to play audio sounds (like alarm bells) when the app is backgrounded. Together these packages are generally working well but the app does sometimes crash. I note, in the the…
Kdon
  • 892
  • 6
  • 19
0
votes
1 answer

Is is possible to use Flutter plugins in an isolate?

I was using VideoCompress plugin with success. But since I moved my video processing to an isolate, I am getting this error: Cannot set the method call handler before the binary messenger has been initialized. This happens when you call…
Stéphane de Luca
  • 12,745
  • 9
  • 57
  • 95
0
votes
0 answers

Sinchronization in Flutter between multiple isolates

I am learning Flutter and trying to make advanced todo application. I want to sync todos with a cloud using aws amplify. The problem is that I need the sync to work not only from isolate of main app but also from isolate spawned by WorkManager. This…
alehro
  • 2,198
  • 2
  • 25
  • 41
0
votes
0 answers

Thread safe writing to file from two isolates in Dart

I have a Flutter app where there are two isolates, the main isolate and another isolate for background works. Now, I write logs to the same file from both isolates. But, when both run concurrently, some partial texts are missed.
Nasif Md. Tanjim
  • 3,862
  • 4
  • 28
  • 38
0
votes
0 answers

Illegal argument in isolate message: (object is a ReceivePort) with MethodChannel

I have a isolate with 2 function: @override void initState() { super.initState(); startDiscovery(); } void startDiscoveryIsolate(SendPort sendPort) async { Timer.periodic(const Duration(seconds: 1), (Timer t) async { await…
joisberg
  • 175
  • 2
  • 13
0
votes
0 answers

how to create isolate function with BLoC

I have a BLoC with an event that repeats every second. How I can move function in a different thread? I would use an isolate but I can't find examples that work with this code class ScanBloc extends Bloc { Timer? _timer; …
joisberg
  • 175
  • 2
  • 13
0
votes
2 answers

How to share common code between multiple flutter engines?

I have a flutter added into my android host project. I am currently having multiple flutter engines. But there is no sharing of code between these engines. Therefore method-channel calls are happening multiple times. I have a single entry point for…
0
votes
0 answers

How to update value from long running isolate in dart?

I am trying to update long running(while true) isolate. the idea is call update everywhere on main or update that value on future. void main() async { final ReceivePort p = ReceivePort(); var events = StreamQueue(p); SendPort sendPort…
Dwiyi
  • 638
  • 7
  • 17
0
votes
0 answers

Run packages in isolate - Flutter

I'm trying to run some image processing and MLmodel prediction inside isolate for all images in the gallery device. But some packages like FaceDetector(from google_ml_kit), and PhotoGallery, don't let me run inside isolate. The question is, exist…
0
votes
1 answer

How to create an isolate for recursive function in flutter?

How can I use isolate to get Fibonacci series in flutter? Actually, I have some bigger problems in which I have to do recursion in large list. By your answer to this question, I will get the tip to my original problem. int Fib(int n){ if(n<=1)…
0
votes
0 answers

Compute -> Unhandled Exception: 'dart:ui/window.dart': Failed assertion: line 298 pos 12: '': is not true

I want to take a screenshot of a widget in a different isolate. Firstly, I tried to take a screenshot in the main thread, and it worked fine but since it's considered a heavy process, I need to do it in a different thread, creating a new isolate.…
Sardonic777
  • 63
  • 1
  • 6
0
votes
2 answers

Can flutter isolates be safely instantiated above runApp()

Hi I instantiated an isolate for my data layer above my main app, above runApp() I wonder what will happen when the app is minimised, will the isolate be closed. Do isolates time out anyway... Has anyone got experience of this in a live app?
Dan Horton
  • 371
  • 3
  • 11
0
votes
0 answers

How to delete vertex with degree = 0 in R (social network data)?

I want to delete vertices with the code below but have this error message: Error in delete.vertices(n_all, V(n_all)[degree(n_all) == 0]) : delete.vertices requires an argument of class network. I follow some suggestions from here (remove…
0
votes
0 answers

How to insert delay in event loop to avoid blocking UI during image processing in Flutter?

I'm working on an image processing app. I have an animated gif to show progress. As Dart is a single thread, every time the image is being processed, it locks UI, including the animated gif. I don't want to use isolates to avoid potential memory…
jdevp2
  • 371
  • 5
  • 15