HydrationStrategy enum

Hydration trigger strategies for Bloom islands.

Defines the policy and trigger condition determining when a server-rendered island placeholder is hydrated into an active, interactive DOM subtree.

BloomIsland(
  name: 'image-gallery',
  strategy: HydrationStrategy.visible,
  child: const Div(text: 'Loading gallery...'),
)
Inheritance
Available extensions

Values

immediate → const HydrationStrategy

Hydrates immediately when the document is scanned by BloomIslandOrchestrator.

Best for above-the-fold critical UI elements such as primary navigation or alert banners.

const HydrationStrategy('immediate')
visible → const HydrationStrategy

Hydrates when the placeholder element enters or approaches the browser viewport.

Uses a high-performance IntersectionObserver with a configurable root margin (specified via bloomRootMarginAttribute or BloomIslandOrchestrator.defaultRootMargin). Ideal for below-the-fold widgets, comment sections, and content feeds.

const HydrationStrategy('visible')
idle → const HydrationStrategy

Hydrates when the browser main thread is idle using requestIdleCallback.

Falls back gracefully to a delayed timer in environments where requestIdleCallback is unavailable. Ideal for secondary interactive elements (e.g. analytics panels, footer widgets).

const HydrationStrategy('idle')
interaction → const HydrationStrategy

Hydrates upon the first user interaction targeting the placeholder element.

Listens for pointerenter, pointerdown, focusin, keydown, and touchstart events. Once triggered, removes all event listeners and performs in-place hydration. Ideal for menus, search bars, and dropdown dialogs.

const HydrationStrategy('interaction')
media → const HydrationStrategy

Hydrates only when a CSS media query matches (e.g. desktop-only sidebars or mobile-only drawers).

Evaluates window.matchMedia with the query configured in bloomMediaAttribute. If the query does not match initially, observes media changes and hydrates as soon as it matches.

const HydrationStrategy('media')
never → const HydrationStrategy

Never hydrates automatically; the server-rendered HTML markup remains purely static.

Useful for conditionally rendering interactive components as static content on pages where client JavaScript is not required.

const HydrationStrategy('never')

Properties

hashCode int
The hash code for this object.
no setterinherited
index int
A numeric identifier for the enumerated value.
no setterinherited
name String

Available on Enum, provided by the EnumName extension

The name of the enum value.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
value String
The raw serialized string value corresponding to this strategy.
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
override

Operators

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

Static Methods

parse(String? value, {HydrationStrategy defaultStrategy = HydrationStrategy.immediate}) HydrationStrategy
Parses a strategy name string into a HydrationStrategy, supporting common aliases.

Constants

values → const List<HydrationStrategy>
A constant List of the values in this enum, in order of their declaration.