Stop Dart before pressing a key

Is there a way to stop the Dart process from running before a key is pressed?

It will be something like:

  • In the html file:
<input id="nextstep" type="button" value="nextstep" /> 
  • In the dart file:
 void main() { while(true) { // Do something here to pause the loop // until the nextstep button is pressed } } 
+4
source share
1 answer

You can simply add a keyPress listener to your input to start some additional processing.

 void main() { final input = querySelector("#nextstep"); input.onKeyPress.listen((e){ nextProcessingStep(); }); } 
+6
source

All Articles