flutter – influtter,I want to monitor the exit when the memory is cleared

In flutter, how to listen to exit the clear memory, I tried didChangeAppLifecycleState findings do not listen to exit the clear memory, the console will prompt Lost connection to device.

i found some answers,but They can not give me inspiration and resolve doubts

I need everyone’s help

class _MainAppState extends State<MainApp> with WidgetsBindingObserver {
  @override
  void didChangeAppLifecycleState(AppLifecycleState state) async {
    // TODO: implement didChangeAppLifecycleState
    //super.didChangeAppLifecycleState(state);
    switch (state) {
      case AppLifecycleState.resumed:
        print("app in resumed");
        break;
      case AppLifecycleState.inactive:
        print("app in inactive");
        break;
      case AppLifecycleState.paused:
        print("app in paused");
        break;
      case AppLifecycleState.detached:
        print("app in detached");
        break;
    }
  }

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

  @mustCallSuper
  @protected
  @override
  void dispose() {
    alarCannel();
    WidgetsBinding.instance.removeObserver(this);
    print('shutdown!!!!!!!!!!!!!!!!!!');
    super.dispose();
  }
  @override
  Widget build(BuildContext context) {
     .........
  }
}