betrayal 1.2.4 icon indicating copy to clipboard operation
betrayal: ^1.2.4 copied to clipboard


A plugin to setup custom system tray icons through composable widgets.

skip to content

A capable tray icon plugin for Windows.

🔗 package on
🔗 source on
🔗 dart docs api reference

Manage multiple icons 👨‍👩‍👦‍👦,
generate their images at runtime 🎨
and compose them just like a widget 🎶

Features #

pub score pub version (including pre-releases) joke shield[^1] pub publisher

  • Control multiple tray icons
  • Many options for setting the tray icons image
    • .ico file either from the file system or the Flutter assets directory
    • Set the pixels directly through an image buffer - you can use this to dynamically create an image via canvas!
    • Use default system icons like the ❔ or the elevation prompt 🛡️
  • Widget api - treat the tray icon as part of your UI and compose it in your build methods

Usage #

After you've added betrayal to your dependencies via flutter pub add betrayal and flutter pub get, you can start to use it:

import 'package:betrayal/betrayal.dart';

// ...

Widget build(BuildContext context) => MaterialApp(
  home: Scaffold(
    appBar: AppBar(
      title: const Text("Look at the system tray 👀")
    body: Center(
      // The icon will be visible aslong as the [TrayIconWidget] will be built
      child: TrayIconWidget(
        winIcon: WinIcon.application,
        tooltip: "Here I am!"
        child: FlutterLogo()

If you just want a tray icon, that's pretty much all you need to know.

There is, however, also a quick-guide, four example applications and of course the API docs, if you do want to learn more.

Don't hesitate to file an issue, I'll have a look at it eventually 😊

Development #

Style #

Use for commits.
Use for docs.

Overview #

  graph LR;
    BetrayalPlugin o----o |connects via platform channel to| betrayal_plugin.cpp
    subgraph dart
    TrayIconWidget -- manages --> TrayIcon -- calls --> BetrayalPlugin
    TrayIcon -- uses --> TrayIconImageDelegate -- calls --> BetrayalPlugin
    subgraph native
    betrayal_plugin.cpp -- holds --> IconManager.hpp
    IconManager.hpp -- provides TrayIcon.hpp to --> betrayal_plugin.cpp
    betrayal_plugin.cpp -- calls --> TrayIcon.hpp
    click BetrayalPlugin ""
    click TrayIcon ""
    click TrayIconWidget ""
    click TrayIconImageDelegate ""
    click betrayal_plugin.cpp ""
    click IconManager.hpp ""
    click TrayIcon.hpp ""

[^1]: This is a lie. Flutter does not support Windows 2000. Betrayal.

pub points


verified publisher

A plugin to setup custom system tray icons through composable widgets.

Repository (GitHub)
View/report issues


API reference


Icon for licenses.MIT (LICENSE)


flutter, logging, path


Packages that depend on betrayal