Answers for "flutter check if app is in foreground"

0

flutter check if app is in foreground

class _MyHomePageState extends State<MyHomePage> with WidgetsBindingObserver {
  late AppLifecycleState _notification; 
  @override
  void didChangeAppLifecycleState(AppLifecycleState state) {
    setState(() {
      _notification = state;
    });
  }

  @override
  initState() {
    super.initState();
    WidgetsBinding.instance!.addObserver(this);
    ...
  }

  @override
  void dispose() {
    WidgetsBinding.instance!.removeObserver(this);
    super.dispose();
  }
}
Posted by: Guest on April-24-2021

Code answers related to "flutter check if app is in foreground"

Code answers related to "TypeScript"

Browse Popular Code Answers by Language