safeExecute function

void safeExecute(
  1. VoidCallback? callback, {
  2. String? context,
})

Implementation

void safeExecute(VoidCallback? callback, {String? context}) {
  if (callback == null) return;

  try {
    callback();
  } catch (e, stackTrace) {
    _logSecurity(
      'Button callback error${context != null ? ' in $context' : ''}: $e',
      stackTrace: stackTrace,
    );
    // In production, you might want to report this to a crash reporting service
  }
}