awaitButtonPress method
- ComponentId componentId
inherited
Wait for a user to press a button and return a context representing that button press.
You might also be interested in:
- awaitSelection and awaitMultiSelection, for getting a selection from a user.
Implementation
@override
Future<ButtonComponentContext> awaitButtonPress(ComponentId componentId) async {
if (delegate != null) {
return delegate!.awaitButtonPress(componentId);
}
try {
ButtonComponentContext context = await commands.eventManager.nextButtonEvent(componentId);
context._parent = this;
_delegate = context;
return context;
} on TimeoutException catch (e, s) {
throw InteractionTimeoutException(
'Timed out waiting for button press on component $componentId',
_nearestCommandContext,
)..stackTrace = s;
}
}