awaitButtonPress method

  1. @override
Future<ButtonComponentContext> awaitButtonPress(
  1. 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:

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;
  }
}