of method Null safety

DataTableThemeData of(
  1. BuildContext context
)

Returns the configuration data from the closest DataTableTheme ancestor. If there is no ancestor, it returns ThemeData.dataTableTheme. Applications can assume that the returned value will not be null.

Typical usage is as follows:

DataTableThemeData theme = DataTableTheme.of(context);

Implementation

static DataTableThemeData of(BuildContext context) {
  final DataTableTheme? dataTableTheme = context.dependOnInheritedWidgetOfExactType<DataTableTheme>();
  return dataTableTheme?.data ?? Theme.of(context).dataTableTheme;
}