SuspenseNode<T> class
Declarative async boundary that renders fallback while resource resolves.
DOM Mounting and SSR
- Browser (
mount): Mounts between sentinel comments<!-- bloom:suspense -->and<!-- /bloom:suspense -->. Mounts fallback initially while asynchronously awaiting resource. When the future completes, disposes the fallback region and mountsbuilder(data)between the sentinels. If resource rejects, renders errorBuilder if provided or bubbles the error to the nearest ErrorBoundary. - Streaming SSR (
renderToStreamWithSuspense): Emits fallback in the initial HTML shell wrapped in<div id="bloom-suspense-N">. When resource resolutes on the server, streams an out-of-order<script>tag that replaces the fallback container'souterHTMLwith the resolved content. - Synchronous SSR (
renderToHtml): Renders fallback only.
Usually created using the DSL sugar Suspense.
Constructors
-
SuspenseNode({required Future<
T> resource(), required BloomNode builder(T data), required BloomNode fallback, BloomNode errorBuilder(Object error, StackTrace stackTrace)?}) -
Creates a suspense boundary descriptor with async
resource, resolvedbuilder, loadingfallback, and optionalerrorBuilder.const
Properties
- builder → BloomNode Function(T data)
-
Builder constructing the descriptor tree once resource resolves with
data.final - builderErased → BloomNode Function(Object? value)
-
builder, accepting untyped resolved
Object?data.no setter - errorBuilder → BloomNode Function(Object error, StackTrace stackTrace)?
-
Optional error builder invoked if resource rejects with an exception.
final
- fallback → BloomNode
-
Descriptor tree displayed while resource is still pending.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
-
resource
→ Future<
T> Function() -
Async factory returning a Future with the resolved data of type
T.final -
resourceErased
→ Future<
Object?> Function() -
resource, viewed untyped as
Future<Object?> Function().no setter - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited