With Flutter’s App Lifecycle you can detect if your app moved to the background, foreground or if your app was closed.

Source Code | https://github.com/JohannesMilke/widgets_binding_example

TIMELINE

  • 0:00 Introduction Detect App Background & Closed
  • 0:30 Setup WidgetsBindingObserver
  • 0:58 Introduction Lifecycle Change
  • 3:10 Execute On Moved To Background
  • 3:53 Execute On Moved To Foreground
  • 4:14 initState vs Resumed

#flutter

Flutter Tutorial - Detect App Background & App Closed - Widgets Binding
16.70 GEEK