title: Flutter: How to automatically trigger a function when a route was pushed on to the stack?
body: <p>I want to trigger automatically trigger a function when a screen is pushed on to the stack. I have been doing some research and I think this could be achieved by extending <code>WidgetsBindingObserver</code> class.</p>
  <p>Once I have extended it, calling <code>didPushRoute</code> method should be the way to go. So the first thing is to ask if I could be right with this approach.</p>
  <p>The second question, and request if you will, would be to ask for a specific implementation or example of this, if it’s the case that the mentioned approach is correct. Doing the same when popping a route is another thing I want, but I think it is on the same line. The main idea of this approach would be to make specific things happen <strong>automatically</strong> when navigating.</p>
  <p><strong>I am looking for something that always happen when the current route / or a specific stateless or stateful gets covered by another screen, rather than manually executing a function with navigator, otherwise I would need to do this for every new push I want to do.</strong></p>
  <p>Thanks in advance for the feedback and let me know if have to explain something deeper of what I am trying to achieve.</p>