deferred<T> static method
Creates a deferred computation that runs in a microtask and returns LxStatus.
This is useful when you want to convert a synchronous calculation into a status-wrapped asynchronous flow without explicitly using async/await. Creates a deferred computation that runs in a microtask and returns LxStatus.
This is useful when you want to convert a synchronous calculation into a status-wrapped asynchronous flow without explicitly using async/await.
Implementation
static LxAsyncComputed<T> deferred<T>(
T Function() compute, {
bool Function(T previous, T current)? equals,
bool showWaiting = false,
bool staticDeps = false,
T? initial,
String? name,
}) {
return LxAsyncComputed<T>(
() async => compute(),
equals: equals,
showWaiting: showWaiting,
staticDeps: staticDeps,
initial: initial,
name: name,
);
}