I am developing a note app, and I want to save my note when I closed the app (when removing the app from recent apps).
I tried dispose() method but it did not work.
I tried :
@override
void didChangeAppLifecycleState(AppLifecycleState state) {
print(state);
final isDetached = state == AppLifecycleState.detached;}
but it did not work too. it does not print detached status, just it prints AppLifecycleState.paused AppLifecycleState.inactive AppLifecycleState.resume
so what should I do here!!
You can always use shared preferences in that case. Share preferences are used to save data in your local storage and the implementation is also very simple. and don't worry it won't make your app laggy or slow. It works very smoothly
https://pub.dev/packages/shared_preferences
do upvote if helpful