title: Is there a way to call specific code right before the app is killed or moves to the background?
body: <p>I want to write the user's preferences to a file before they leave the app, so I'm looking for something in Flutter like Android's onPause() or onStop() methods.  Is this something so platform-specific that I'd need to write services for it and actually use Android/iOS's specific methods for these situations or is there a way to do it only using Flutter/Dart?</p>