pause function

Future<void> pause({
  1. StringSink? output,
  2. PromptAnswerReader answerReader = defaultAnswerReader,
})

Notice

This function does block the calling Isolate, until a full line is available. If you do not want to block, use the asynchronous version instead.

See pauseSync.

Description

Wait until the user presses any key.

output defaults to stdout.

Implementation

Future<void> pause({
  StringSink? output,
  PromptAnswerReader answerReader = defaultAnswerReader,
}) async {
  final oSink = output ?? stdout;

  oSink.writeln("Press any key to continue...");
  await answerReader();
}