2

Is there any code to detect if user pressed home / tab ? i want make my music pause when it pressed

Arvin
  • 831
  • 2
  • 10
  • 14

1 Answers1

4

To track lifecycle events by adding an observer to WidgetsBinding and then pause the music when the app pauses. You can take look at this example. For all the lifecycle states look into AppLifecycleState.

Hope that helped!

Hemanth Raj
  • 32,555
  • 10
  • 92
  • 82