of method Null safety

CheckboxThemeData of(
  1. BuildContext context
)

Returns the configuration data from the closest CheckboxTheme ancestor. If there is no ancestor, it returns ThemeData.checkboxTheme.

Typical usage is as follows:

CheckboxThemeData theme = CheckboxTheme.of(context);

Implementation

static CheckboxThemeData of(BuildContext context) {
  final CheckboxTheme? checkboxTheme = context.dependOnInheritedWidgetOfExactType<CheckboxTheme>();
  return checkboxTheme?.data ?? Theme.of(context).checkboxTheme;
}