I've got Data messages appearing beautifully in the background via FCM in Flutter(Android). I then process the message and finish my tasks everything works great.
I use:
FirebaseMessaging.onBackgroundMessage
This onBackgroundMessage handler is async and I await a sequence of calls.
I would have assumed once the future is completed it would suspend everything and the app would go back to sleep.
However if I create Stream.periodic as part of the background handler and output a value it seems to keep going even through I've completed the onBackgroundMessage handler.
So the question is:
What's the correct way to tell flutter I'm finished so it kills the background isolate?
Is it detecting my leaked Stream subscription and not killing me?
Is there a way to forcefully kill it?
Thanks :)