title: Flutter: How can I prevent default behaviour on key press?
body: <p>I'm trying to intercept when a user presses the volume buttons to perform a specific action and prevent the default behaviour (volume changes).</p>
  
  <p>This is the code I have so far:</p>
  
  <pre><code>RawKeyboard.instance.addListener(_keyboardListener);
  
  void _keyboardListener(RawKeyEvent e) {
    if(e.runtimeType == RawKeyUpEvent) {
      RawKeyEventDataAndroid eA = e.data;
      if(eA.keyCode == 24) { //volume up key
        _goNextPage();
      }
      if(eA.keyCode == 25) { //volume down key
        _goPrevPage();
      }
    }
  }
  </code></pre>
  
  <p>How would I go about preventing the volume from changing (and stopping the volume slider from appearing at the top)?</p>
  
  <p>A Javascript analogous would be calling <code>event.preventDefault()</code> on the key event.</p>
  
  <p>This seems to be a rather trivial matter, but I haven't been able to find any answers in the docs.</p>
  
  <p>Thanks.</p>