of static method

Find OverlaySupportEntry by context.

The context should be the BuildContext which build a element in Notification.

Implementation

static OverlaySupportEntry? of(BuildContext context) {
  final animatedOverlay =
      context.findAncestorWidgetOfExactType<_AnimatedOverlay>();
  assert(() {
    if (animatedOverlay == null) {
      throw FlutterError('No KeyedOverlay widget found.\n'
          'The [context] should be the BuildContext which build a element in Notification.\n'
          'is that you called this method from the right scope? ');
    }
    return true;
  }());
  if (animatedOverlay == null) {
    return OverlaySupportEntry.empty();
  }
  return animatedOverlay.overlaySupportState
      .getEntry(key: animatedOverlay.overlayKey);
}