of static method

Gets the overlay manager from the widget tree.

Searches for an OverlayManager in the build context and throws an assertion error if not found.

Parameters:

  • context (BuildContext, required): Build context

Returns the OverlayManager instance.

Implementation

static OverlayManager of(BuildContext context) {
  var manager = Data.maybeOf<OverlayManager>(context);
  assert(manager != null, 'No OverlayManager found in context');
  return manager!;
}