didChangeAppLifecycleState(AppLifecycleState state) { print('*** state = ${state.toString()}'); } @override void initState() { super.initState(); WidgetsBinding.instance.addObserver(this); } @override void dispose() { super.dispose(); WidgetsBinding.instance.removeObserver(this); }