maybeOf static method

TextHeightBehavior? maybeOf(
  1. BuildContext context
)

The closest instance of DefaultTextHeightBehavior that encloses the given context, or null if none is found.

If no such instance exists, this method will return null.

Calling this method will create a dependency on the closest DefaultTextHeightBehavior in the context, if there is one.

Typical usage is as follows:

TextHeightBehavior? defaultTextHeightBehavior = DefaultTextHeightBehavior.of(context);

See also:

Implementation

static TextHeightBehavior? maybeOf(BuildContext context) {
  return context.dependOnInheritedWidgetOfExactType<DefaultTextHeightBehavior>()?.textHeightBehavior;
}