title: Flutter how to execute function on back pressed
body: <p>I need to call a function when the user presses the back button in my flutter application, in android with java I could use the following code to achieve it</p>
  
  <pre><code>@Override
  public void onBackPressed() {
  //some function
  }
  </code></pre>
  
  <p>Is there something similar in flutter?</p>