-
-
Notifications
You must be signed in to change notification settings - Fork 1k
Description
Is your feature request related to a problem? Please describe.
Related to #4352. Use case: cleanup timers etc stored in state during onDispose
Describe the solution you'd like
I'd like a readonly view of state during lifecycle callbacks. Especially onDispose, but I guess onCancel and onResume would be interesting too for others.
I can think of two ways to implement this:
- allow readonly access to
stateduring those callbacks (but prevent writes) - pass current state as part of
onDisposecallback
Describe alternatives you've considered
The examples usually use final variables in build and access them during cleanup. In my scenario, the value can change over time, so this approach doesn't work.
All other ideas that I came up with are hacky at best and I didn't even verify if they would work (static variables, member variables that duplicate the relevant values of state etc)
Additional context
N/A