maybeOf<TSlot extends Object, TData> static method

SlotRegistry<TSlot, TData>? maybeOf<TSlot extends Object, TData>(
  1. BuildContext context
)

Returns the nearest matching registry, if any.

Implementation

static SlotRegistry<TSlot, TData>? maybeOf<TSlot extends Object, TData>(
  BuildContext context,
) {
  return context
      .dependOnInheritedWidgetOfExactType<
        _SlotRegistryProvider<TSlot, TData>
      >()
      ?.registry;
}