safeExecute<T> static method
Safely execute a function with error handling.
Implementation
static T? safeExecute<T>(
T Function() function, {
ErrorCallback? onError,
String? context,
}) {
try {
return function();
} catch (error, stackTrace) {
handleError(error, stackTrace, customHandler: onError, context: context);
return null;
}
}