runAsync method

void runAsync(
  1. Future<void> action()
)

Runs the provided async action after the debounce delay.

Similar to run but supports async functions.

Implementation

void runAsync(Future<void> Function() action) {
  cancel();
  timer = Timer(delay, () async {
    try {
      await action();
    } catch (error, stackTrace) {
      // Log error but don't rethrow to prevent unhandled exceptions
      debugPrint('Debouncer async action error: $error\n$stackTrace');
    }
  });
}