3

Say I have a Flutter TODO app in with three routes:

  • Home, which shows all TODO item summaries;
  • TODO details, which shows a TODO item details when the user taps on an item in the Home screen.
  • Edit TODO details, a popup route that partially covers the screen when the user taps "edit" on the TODO details screen.

This means that at some point the Route stack could be:

  • [Edit TODO details] (Current)
  • [TODO details]
  • [Home]

How can I make it so that when the OS eventually paused the app, I can save this stack and then rebuild it when the app is resumed?

Akif
  • 7,098
  • 7
  • 27
  • 53
PaoloVictor
  • 1,296
  • 8
  • 18
  • You have to hook into the lifecycle events of the app and respond to state changes (see [this example code](https://github.com/flutter/flutter/blob/master/examples/layers/services/lifecycle.dart) and [corresponding docs](https://docs.flutter.io/flutter/dart-ui/AppLifecycleState-class.html)). When the app is ready to pause, save the state, e.g. using local storage, see https://stackoverflow.com/questions/41369633/how-can-i-save-to-local-storage-using-flutter. – raju-bitter May 25 '17 at 23:02
  • @raju-bitter: Why don't you write your comment as an answer? I think this would be the way to go. – Rainer Wittmann May 26 '17 at 19:27

0 Answers0