safeUpdateAsync<T> static method
Execute an async function safely, returning fallback on error
Implementation
static Future<T?> safeUpdateAsync<T>(
Future<T> Function() update, {
T? fallback,
}) async {
try {
return await update();
} catch (e, stackTrace) {
Logger.error('Async state update error', e);
Logger.debug('Stack trace', stackTrace);
return fallback;
}
}