safeUpdateWithHandler<T> static method
Execute a function with custom error handler
Implementation
static T safeUpdateWithHandler<T>(
T Function() update,
T Function(Object error, StackTrace stackTrace) onError,
) {
try {
return update();
} catch (e, stackTrace) {
Logger.error('State update error (custom handler)', e);
Logger.debug('Stack trace', stackTrace);
return onError(e, stackTrace);
}
}