maybeOf static method Null safety

MaterialInkController? maybeOf(
  1. BuildContext context
)

The ink controller from the closest instance of this class that encloses the given context.

Typical usage is as follows:

MaterialInkController? inkController = Material.maybeOf(context);

This method can be expensive (it walks the element tree).

See also:

Implementation

static MaterialInkController? maybeOf(BuildContext context) {
  return context.findAncestorRenderObjectOfType<_RenderInkFeatures>();
}