of method Null safety

TooltipThemeData of(
  1. BuildContext context
)

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

Typical usage is as follows:

TooltipThemeData theme = TooltipTheme.of(context);

Implementation

static TooltipThemeData of(BuildContext context) {
  final TooltipTheme? tooltipTheme = context.dependOnInheritedWidgetOfExactType<TooltipTheme>();
  return tooltipTheme?.data ?? Theme.of(context).tooltipTheme;
}