attach static method

void attach(
  1. BuildContext context
)

Remembers the root overlay of context.

Safe to call on every build: only the first overlay is kept.

Implementation

static void attach(BuildContext context) {
  final OverlayState? current = _overlay;
  if (current != null && current.mounted) return;
  _overlay = Overlay.maybeOf(context, rootOverlay: true);
}