Flutter How to use lifecycle events in stateless widget? App on close
7,230
Solution 1
This package might do the trick. https://pub.dev/packages/flutter_lifecycle_state
Solution 2
A stateless widget can only be drawn once when the Widget is loaded/built and cannot be redrawn based on any events or user actions.
This kind of widget has no state, so they can’t change according to an internal state, they only react to higher widget changes.
Author by
otto
Updated on December 14, 2022Comments
-
otto over 1 year
I am using the new changeNotifier, so I dont use statefull Widgets at all. How can I use lifecycle events in stateless widget? I only found example for statefull widget. I specially need a event when the app gets destroyed. https://flutter.dev/docs/get-started/flutter-for/android-devs#how-do-i-listen-to-android-activity-lifecycle-events