safeExecuteAsync function

Future<void> safeExecuteAsync(
  1. Future<void> callback()?, {
  2. String? context,
})

Implementation

Future<void> safeExecuteAsync(
  Future<void> Function()? callback, {
  String? context,
}) async {
  if (callback == null) return;

  try {
    await callback();
  } catch (e, stackTrace) {
    _logSecurity(
      'Button async callback error${context != null ? ' in $context' : ''}: $e',
      stackTrace: stackTrace,
    );
  }
}