of method Null safety

DefaultSelectionStyle 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 DefaultSelectionStyle.fallback, which contains fallback values.

Typical usage is as follows:

DefaultSelectionStyle style = DefaultSelectionStyle.of(context);

Implementation

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