I want to calculate every pages stay duration of my flutter app. The stay duration means from page becomes visible to page hide.
How do i do this?
Any idea might help me.
I want to calculate every pages stay duration of my flutter app. The stay duration means from page becomes visible to page hide.
How do i do this?
Any idea might help me.
2
Answers
An idea would be to capture the time at
initState
for stateful widgets, or underbuild
method for stateless widgets, and compare it with the time on leave, as follows:To learn how to detect when the user moves away from the current page take a look at this answer:
Detect if the user leaves the current page in Flutter?
You can use this wrapper widget,