clearAll static method

void clearAll()

Disposes all icons and clears up any residual icons.

Use this method to clean up after a hot restart, if you aren't going to immediately create a new TrayIcon.

void main() {
  // Hot restarts only happen in debug mode
  if (kDebugMode) TrayIcon.clearAll();
  runApp(const MyApp());
}

Implementation

static void clearAll() {
  for (final TrayIcon icon in _allIcons.values) {
    icon._isActive = false;
    icon._logger.fine("disposed by `clearAll`");
  }
  _allIcons.clear();
  _plugin.reset();
}