ModalRoute.of(context).isCurrent

hello everyone, i’m new to flutter and need help. I navigate on page. I am using ModalRoute.of (context) .isCurrent to detect the current page. when i’m on page1 modal route gives me good, when i’m on page2 it gives me too. but when I return to page 1, it no longer detects.
Thank you for your help