of static method

TapRegionRegistry of(
  1. BuildContext context

Allows finding of the nearest TapRegionRegistry, such as a RenderTapRegionSurface.

Will throw if a TapRegionRegistry isn't found.


static TapRegionRegistry of(BuildContext context) {
  final TapRegionRegistry? registry = maybeOf(context);
  assert(() {
    if (registry == null) {
      throw FlutterError(
        'TapRegionRegistry.of() was called with a context that does not contain a TapRegionSurface widget.\n'
        'No TapRegionSurface widget ancestor could be found starting from the context that was passed to '
        'The context used was:\n'
        '  $context',
    return true;
  return registry!;