of static method

TrayIcon of(
  1. BuildContext context
)

Retrieve the TrayIcon managed by a TrayIconWidget further up the tree.

Implementation

static TrayIcon of(BuildContext context) {
  final TrayIcon? result =
      context.dependOnInheritedWidgetOfExactType<_TrayIconHeritage>()?.icon;
  assert(result != null, 'No TrayIcon found in context');
  result!._logger.fine("provided by `_TrayIconHeritage`");
  return result;
}