deferred<T> static method
LxAsyncComputed<T>
deferred<T>(
- T compute(), {
- bool equals(
- T previous,
- T current
- bool showWaiting = false,
- bool staticDeps = false,
- T? initial,
- String? name,
- LxAsyncConcurrency concurrency = LxAsyncConcurrency.latest,
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,
LxAsyncConcurrency concurrency = LxAsyncConcurrency.latest,
}) {
return LxAsyncComputed<T>(
() async => compute(),
equals: equals,
showWaiting: showWaiting,
staticDeps: staticDeps,
initial: initial,
name: name,
concurrency: concurrency,
);
}