async<T> static method

LxAsyncComputed<T> async<T>(
  1. Future<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 an asynchronous computed value.

  • compute: The async function to calculate the value.
  • showWaiting: If true, the status transitions to LxWaiting during recomputations. Defaults to false (stale-while-revalidate).
  • initial: Optional initial value.
  • staticDeps: If true, the dependency graph is built only once.

Implementation

static LxAsyncComputed<T> async<T>(
  Future<T> Function() compute, {
  bool Function(T previous, T current)? equals,
  bool showWaiting = false,
  bool staticDeps = false,
  T? initial,
  String? name,
}) {
  return LxAsyncComputed<T>(
    compute,
    equals: equals,
    showWaiting: showWaiting,
    staticDeps: staticDeps,
    initial: initial,
    name: name,
  );
}