6

I am using dart isolates to play music in background. I want to get the instance of the isolate that I spawned earlier to stop the music after closing and re-opening the Flutter App.

Is there a way to get the instance of existing isolates after re-opening the Flutter app?

jluckyiv
  • 3,691
  • 3
  • 22
  • 15
Power Coding
  • 71
  • 1
  • 3

1 Answers1

-2

An isolate does not keep running in the background when the application is not in foreground.

For currently available solutions see https://medium.com/flutter-io/executing-dart-in-the-background-with-flutter-plugins-and-geofencing-2b3e40a1a124

For

https://github.com/flutter/flutter/issues/24278 https://github.com/flutter/flutter/issues/26178

Günter Zöchbauer
  • 623,577
  • 216
  • 2,003
  • 1,567
  • But I printed 'Hello!' in the background using Isolate! And document says I can do background work. https://flutter.io/docs/development/packages-and-plugins/background-processes. I've already read the Medium example. It was too difficult to understand. I am not familiar with Kotlin and do not have a door, so I think it is hard to test properly. – Power Coding Jan 31 '19 at 14:23
  • Depends on what you mean by "background". If the app is kicked out of memory because of resource shortage than all isolates will be killed with it. If you move the app to the background this usually does not happen immediately. – Günter Zöchbauer Jan 31 '19 at 15:24
  • 1
    How do you get the instance of already running isolates ? – Kashish Khullar Jul 07 '21 at 12:29
  • This answer seems to be outdated by now: https://flutter.dev/docs/development/packages-and-plugins/background-processes – SePröbläm Aug 29 '21 at 18:57