of method Null safety

TextHeightBehavior? of(
  1. BuildContext context
)

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

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

Typical usage is as follows:

DefaultTextHeightBehavior defaultTextHeightBehavior = DefaultTextHeightBehavior.of(context);

Implementation

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