execute static method

dynamic execute(
  1. BuildContext context, {
  2. String? debouncerKey,
})

Attempts to find and activate the action located in a parent widget to an input. context should be the BuildContext of a child widget to a Debouncer widget. debouncerKey is an optional key that can be used to find a specific Debouncer widget if multiple parent Debouncers exist.

If there is no Debouncer widget parent, an Exception is thrown. If there are multiple Debouncer widget parents, but no debouncerKey is provided, this function activates the first Debouncer it finds.

Implementation

static execute(BuildContext context, {String? debouncerKey}) {
  final elToExecute = Debouncer.findDebouncerWidget(
    context,
    debouncerKey: debouncerKey,
  );

  if (elToExecute == null) {
    throw NoDebouncerFoundException('No Debouncer parent object present');
  }

  elToExecute.execute();
}