4

キーが押されるまで Dart プロセスの実行を停止する方法はありますか?

これは次のようになります。

  • html ファイル内:
<input id="nextstep" type="button" value="nextstep" />
  • ダーツファイルで:
void main() { 
  while(true) {
    // Do something here to pause the loop 
    // until the nextstep button is pressed
  } 
}
4

1 に答える 1

6

keyPressリスナーを追加するだけで、追加のinput処理を開始できます。

void main() { 
  final input = querySelector("#nextstep");
  input.onKeyPress.listen((e){
    nextProcessingStep();
  });
} 
于 2013-01-08T07:35:37.857 に答える