runAction<R> method
Runs an async action with automatic loading/error handling.
Implementation
Future<R?> runAction<R>(PlexAsyncAction<R> action) async {
showLoading();
try {
final result = await action.run();
action.onSuccess?.call(result);
return result;
} catch (e, s) {
action.onError?.call(e, s);
PlexLogger.e('PlexAsyncAction', e.toString(), error: e, stack: s);
return null;
} finally {
hideLoading();
}
}