waitForKey method
void
waitForKey()
Waits for any matching key event using KeyEventReader.
This is a convenience method for simple "wait for key" scenarios that don't need a full render loop.
Example:
final bindings = KeyBindings.continuePrompt();
bindings.waitForKey(); // Blocks until Enter, Esc, or Space
Implementation
void waitForKey() {
while (true) {
final event = KeyEventReader.read();
final result = handle(event);
if (result != KeyActionResult.ignored &&
result != KeyActionResult.handled) {
break;
}
// For simple wait scenarios, also break on 'handled' if there are no 'ignored' results possible
if (result == KeyActionResult.handled) {
break;
}
}
}