Reputation: 195
Route A and Route B with buttons that can send to the other route when tapped (Route A with a button, Route B with a button on the bottombar).
Route A --uses Navigator.pushNamed() to send to--> Route B.
Route B --uses Navigator.pushReplacementNamed() to send to--> Route A.
And so on. Imagine to tap to obtain a loop.
Page A initState() is called multiple times but Page A dispose() is never called.
Does it mean that the memory is filling up of zombie Page A instances?
Upvotes: 1
Views: 287
Reputation: 4434
this is what i understand.
when you pushReplacementNamed
to new route, navigator will remove current route and based on documentation said
The returned route will be pushed into the navigator.
eg: we are from A to B .
then we pushReplacementNamed
to A, so it only replace route B from navigator and return all route before B (if exist) to current navigator.
then if you pushNamed
from A again ,
yes its not disposed.
Upvotes: 2