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,
  7. LxAsyncConcurrency concurrency = LxAsyncConcurrency.latest,
})

Creates an asynchronous computed value.

The compute function must return a Future.

Set showWaiting to true to emit LxWaiting when recomputing. Set staticDeps to true if the dependency graph is constant.

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,
  LxAsyncConcurrency concurrency = LxAsyncConcurrency.latest,
}) {
  return LxAsyncComputed<T>(
    compute,
    equals: equals,
    showWaiting: showWaiting,
    staticDeps: staticDeps,
    initial: initial,
    name: name,
    concurrency: concurrency,
  );
}