defaultOverlayHost function

HintOverlayHost Function(HintController) defaultOverlayHost({
  1. HintTargetRegistry? registry,
  2. OverlayState? overlay()?,
})

Standard render-mechanics wiring: the engine over registry (defaults to the registry singleton — zero-config).

The only public entry into render mechanics, for HintController:

final controller = HintController(overlayHostBuilder: defaultOverlayHost());

Pass overlay explicitly for targetRect-only tours with zero mounted targets (nothing to capture the root overlay from — see targetRect). It is a provider, not a value: it is called when the host is built lazily on the first non-idle state, so a GlobalKey<OverlayState> from the widget tree is already usable there:

final overlayKey = GlobalKey<OverlayState>();
HintController(
  overlayHostBuilder: defaultOverlayHost(
    overlay: () => overlayKey.currentState,
  ),
);

The engine itself and its internals (scrim, placement delegate) stay hidden: they can change without breaking, while this contract is stable.

Implementation

HintOverlayHost Function(HintController) defaultOverlayHost({
  HintTargetRegistry? registry,
  OverlayState? Function()? overlay,
}) {
  return (controller) => HintOverlayEngine(
        registry: registry ?? HintTargetRegistry.defaultInstance,
        input: controller,
        overlay: overlay?.call(),
      );
}