of static method

OutletScope of(
  1. BuildContext context
)

Looks up the nearest OutletScope from context.

Throws a FlutterError when Outlet is used outside a routed view.

Implementation

static OutletScope of(BuildContext context) {
  final scope = context.dependOnInheritedWidgetOfExactType<OutletScope>();
  if (scope != null) return scope;

  throw FlutterError('Outlet must be used inside a routed view.');
}