TrayIcon class Null safety

A system tray icon.

Call show to show the icon. And call dispose once you don't need it anymore.

With setTooltip, setImage and hide you can change the appearance of the icon.

If an icons has been disposed, isActive will return false. And you cannot interact with it anymore. Construct a new one.

To nuke all existing icons, use TrayIcon.clearAll

Available Extensions

Constructors

TrayIcon({Id? id})
Creates a new TrayIcon that controls a single icon in the system tray.

Properties

hashCode int
The hash code for this object.
read-only, inherited
isActive bool
Has this class been disposed?
read-only
isVisible bool
Is this TrayIcon currently visible?
read-only
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited

Methods

dispose() Future<void>
Disposes the icon.
hide() Future<void>
Hides the icon from the system tray.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed.
inherited
setImage({TrayIconImageDelegate? delegate, Uri? path, ByteBuffer? pixels, String? asset, StockIcon? stockIcon, WinIcon? winIcon}) Future<void>
Sets the image on this icon.
setTooltip(String? message) Future<void>
Sets the tooltip text. If message is null, the tooltip is removed.
show() Future<void>
Shows the icon in the system tray.
toString() String
A string representation of this object.
override

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Properties

preferredImageSize Size
The size an icon image set via setImage should be.
read-only
preferredLargeImageSize Size
The size a large icon, for example for a notification bubble should be.
read-only

Static Methods

clearAll() → void
Disposes all icons and clears up any residual icons.
of(BuildContext context) TrayIcon
Retrieve the TrayIcon managed by a TrayIconWidget further up the tree.