Menu

1 / 2

Flutter Desktop Mastery 2: System Tray & Local Notifications

DEV Community·Kingkor Roy Tirtho·6 months ago
#Czr3e2Vo
#desktop#building#initializing#tray#menu
Reading 0:00
15s threshold

The system tray is essential for a lot of desktop apps that needs to run in the background. But due to Flutter’s limited desktop support, again the Flutter Desktop Community has saved us with another much needed plugin.

At Spotube , users expect to control playback from the tray, minimize the app while keeping it running, and have quick access to essential features without opening the main window.

So, we implement a reactive system tray that stays in sync with the app's state. We use the tray_manager package to accomplish that.

Introducing the Dependencies

In Spotube's pubspec.yaml , we include:

dependencies : tray_manager : <latest> local_notifier : <latest> # we use it for state management hooks_riverpod : <latest> window_manager : <latest>

Enter fullscreen mode

Exit fullscreen mode

The tray_manager package provides cross-platform system tray integration, while local_notifier handles desktop notifications.

Building the Tray Menu

Our tray menu is built reactively using Riverpod providers.

In…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.