deferred<T> static method

LxAsyncComputed<T> deferred<T>(
  1. T compute(), {
  2. bool equals(
    1. T previous,
    2. T current
    )?,
  3. bool showWaiting = false,
  4. bool staticDeps = false,
  5. T? initial,
  6. String? name,
})

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,
  );
}