hydrateIsland method

Future<BloomMountHandle?> hydrateIsland(
  1. Element element
)

Manually triggers hydration of the island hosted at element.

Returns the resulting BloomMountHandle, or null if hydration failed.

final element = web.document.querySelector('#special-island')!;
await orchestrator.hydrateIsland(element);

Implementation

Future<BloomMountHandle?> hydrateIsland(web.Element element) async {
  if (_disposed) return null;
  var instance = _islands.cast<BloomIslandInstance?>().firstWhere(
        (inst) => inst?.element == element,
        orElse: () => null,
      );
  if (instance == null) {
    final newOnes = scan(element);
    if (newOnes.isNotEmpty) {
      instance = newOnes.first;
    }
  }
  return instance?.hydrate();
}