of method Null safety

DividerThemeData of(
  1. BuildContext context
)

The closest instance of this class's data value that encloses the given context.

If there is no ancestor, it returns ThemeData.dividerTheme. Applications can assume that the returned value will not be null.

Typical usage is as follows:

DividerThemeData theme = DividerTheme.of(context);

Implementation

static DividerThemeData of(BuildContext context) {
  final DividerTheme? dividerTheme = context.dependOnInheritedWidgetOfExactType<DividerTheme>();
  return dividerTheme?.data ?? Theme.of(context).dividerTheme;
}