of static method

bool of(
  1. BuildContext context
)

Whether tickers in the given subtree should be enabled or disabled.

This is used automatically by TickerProviderStateMixin and SingleTickerProviderStateMixin to decide if their tickers should be enabled or disabled.

In the absence of a TickerMode widget, this function defaults to true.

Typical usage is as follows:

bool tickingEnabled = TickerMode.of(context);

Implementation

static bool of(BuildContext context) {
  final _EffectiveTickerMode? widget = context.dependOnInheritedWidgetOfExactType<_EffectiveTickerMode>();
  return widget?.enabled ?? true;
}