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);
Source
static DefaultTextStyle of(BuildContext context) { return context.inheritFromWidgetOfExactType(DefaultTextStyle) ?? const DefaultTextStyle.fallback(); }