0

I want to execute some code(say calling a REST API) just before the App is swiped off the task list. So far I've tried used WidgetsBindingObserver to detect when the app reaches detached state. The connection is lost before reaching the detached state.

void didChangeAppLifecycleState(AppLifecycleState state) {
super.didChangeAppLifecycleState(state);   

if (_lastLifecycleState == AppLifecycleState.detached) {
  print('DETACHED!');
}

}

Onex
  • 73
  • 4

0 Answers0