safeValueChanged<T> function

void safeValueChanged<T>(
  1. ValueChanged<T>? callback,
  2. T value, {
  3. String? context,
})

Safe value changed callback execution.

Implementation

void safeValueChanged<T>(
  ValueChanged<T>? callback,
  T value, {
  String? context,
}) {
  if (callback == null) return;

  try {
    callback(value);
  } catch (e, stackTrace) {
    _logAppBarSecurity(
      'AppBar value changed error${context != null ? ' in $context' : ''}: $e',
      stackTrace: stackTrace,
    );
  }
}