BloomAsyncBuilder<T> constructor

const BloomAsyncBuilder<T>({
  1. Key? key,
  2. required Bloom<T> bloom,
  3. required Bloom<bool> pending,
  4. required Widget data(
    1. BuildContext context,
    2. T data
    ),
  5. required Widget loading(
    1. BuildContext context
    ),
  6. Widget error(
    1. BuildContext context,
    2. Object error,
    3. StackTrace stackTrace
    )?,
  7. Widget empty(
    1. BuildContext context
    )?,
  8. bool preserveDataOnPending = true,
})

Creates a structured 4-state asynchronous branching widget.

  • bloom: The upstream reactive Bloom node to observe.
  • pending: Required pending indicator pipeline Bloom<bool> tracking asynchronous activity.
  • data: Builder callback invoked when valid payload data of type T is present.
  • loading: Builder callback invoked when the node is in uninitialized or loading state.
  • error: Optional builder callback invoked when an error occurs during evaluation.
  • empty: Optional builder callback invoked when data is empty or node is explicitly empty.
  • preserveDataOnPending: Whether to retain prior valid data during background re-evaluation. Defaults to true.
  • key: Optional widget key.

Requires:

  • bloom, pending, data, and loading must not be null.

Ensures:

  • Returns a reactive BloomWidget handling all 4 asynchronous states cleanly with optional SWR retention.

Implementation

const BloomAsyncBuilder({
  super.key,
  required this.bloom,
  required this.pending,
  required this.data,
  required this.loading,
  this.error,
  this.empty,
  this.preserveDataOnPending = true,
});