of static method

TooltipThemeData of(
  1. BuildContext context
)

Returns the ambient tooltip theme.

The result comes from the closest TooltipTheme ancestor if any, and otherwise from Theme.of and ThemeData.tooltipTheme.

When a widget uses this method, it is automatically rebuilt if the tooltip theme later changes, so that the changes can be applied.

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;
}