BloomIslandOrchestrator class

Orchestrates discovery, hydration strategy evaluation, and lifecycle management for Bloom islands.

Scans the document for placeholder DOM elements marked with bloomIslandAttribute (data-bloom-island), matches them against registered island builders in registry, and evaluates their respective HydrationStrategy triggers.

Failure Isolation

If an island builder throws an exception or fails to hydrate, the error is captured and reported through BloomJsDevTools (and renderDevErrorOverlay in development), leaving all other islands on the page completely unaffected and functioning normally.

Lifecycle and Teardown

When tearing down or navigating away, call dispose to disconnect all intersection observers, remove attached interaction event listeners, cancel idle timers, and dispose mounted islands.

registerIsland('cart', (props) => Cart(count: props['count']));

final orchestrator = BloomIslandOrchestrator();
orchestrator.scan();

// Later on teardown:
orchestrator.dispose();

Constructors

BloomIslandOrchestrator({BloomIslandRegistry? registry, Element? rootElement, String defaultRootMargin = '200px', bool autoScan = true})
Creates a new island orchestrator.

Properties

defaultRootMargin String
Default root margin applied to HydrationStrategy.visible intersection observers.
final
failedIslands List<BloomIslandInstance>
All island instances that failed during hydration.
no setter
hashCode int
The hash code for this object.
no setterinherited
hydratedIslands List<BloomIslandInstance>
All island instances that have successfully hydrated into interactive subtrees.
no setter
isDisposed bool
Whether this orchestrator has been disposed.
no setter
islands List<BloomIslandInstance>
An unmodifiable list of all island instances currently tracked by this orchestrator.
no setter
pendingIslands List<BloomIslandInstance>
All island instances currently awaiting hydration triggers.
no setter
registry BloomIslandRegistry
The island registry providing component builders for discovered placeholders.
final
rootElement → Element?
The root DOM element scanned for island placeholders. Defaults to document.body.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

dispose() → void
Tears down the orchestrator, releasing observers, removing event listeners, and disposing all hydrated island subtrees.
hydrateAll() Future<void>
Forces all currently pending islands to hydrate immediately.
hydrateIsland(Element element) Future<BloomMountHandle?>
Manually triggers hydration of the island hosted at element.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
scan([Element? root]) List<BloomIslandInstance>
Scans root (or rootElement, or document) for unhydrated island placeholders.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited