1

I need to take an action when my app gets destroyed. I tried to use WidgetsBindingObserver and WillPopScope so far but none of them is invoked in case user removes the app from launcher's recent apps. Is there a way to execute some code before app is completely gone?

tomwyr
  • 1,351
  • 2
  • 16
  • 21
  • Possible duplicate of [Flutter detect killing off the app](https://stackoverflow.com/questions/52074265/flutter-detect-killing-off-the-app) – Haroun Hajem Jun 02 '19 at 18:32

1 Answers1

2

As far is I know for now, there is no way in Flutter. But I know a native way in Android (see this link)

You can implement this in your MainActivity or so, see this how to call Android/iOS code from Flutter

I don't know how to do in iOS, but that could be a bit more difficult due to iOS's different app resource handling etc.

Also, it could be a nice idea for a plugin/package. So developers, go ahead ;)