of static method

DefaultTextStyle of(
  1. BuildContext context
)

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

If no such instance exists, returns an instance created by DefaultTextStyle.fallback, which contains fallback values.

Typical usage is as follows:

DefaultTextStyle style = DefaultTextStyle.of(context);

Implementation

static DefaultTextStyle of(BuildContext context) {
  return context.dependOnInheritedWidgetOfExactType<DefaultTextStyle>() ?? const DefaultTextStyle.fallback();
}