A Dart FFI package to send 💬 toasts on Windows. Written in C++, based on WinToast.

Related tags

Desktop desktoasts
Overview

desktoasts

A Dart package to send native 💬 toasts on Windows.

Installation

For Flutter

dependencies:
  ...
  desktoasts: ^0.0.2

For Dart CLI

here

Support

Documentation

Initialize the toasts service.

ToastService? service;

void main() {
  service = new ToastService(
    appName: 'desktoasts',
    companyName: 'alexmercerind',
    productName: 'desktoasts_example',
  );
  runApp(MyApp());
}

Show a toast containing subtitle.

Toast toast = new Toast(
  type: ToastType.text02,
  title: 'Hello World!',
  subtitle: 'This toast contains a subtitle.',
);
service?.show(toast);

Show a toast containing an image.

Toast toast = new Toast(
  type: ToastType.imageAndText02,
  title: 'Hello World!',
  subtitle: 'This toast contains an image.',
  image: new File('C:/Windows/Web/Screen/img100.jpg')
);
service?.show(toast);

Show a toast with actions in it.

Toast toast = new Toast(
  type: ToastType.imageAndText02,
  title: 'Hello World!',
  subtitle: 'This toast contains actions in it.',
  image: new File('C:/Windows/Web/Screen/img100.jpg'),
  actions: [
    'Accept',
    'Decline',
  ]
);
service?.show(toast);

Handling events

service?.stream.listen((event) {
  if (event is ToastDismissed) {
    print('Toast was dismissed.');
  }
  if (event is ToastActivated) {
    print('Toast was clicked.');
  }
  if (event is ToastInteracted) {
    print('${event.action} action in the toast was clicked.');
  }
});

Progress

Done.
  • Simple toasts.
  • Toasts with image.
  • Toasts with actions.
  • UTF16 text in toasts.
  • Event handling.
Yet to be done.
  • Progress bar toasts.
  • Large image toasts.
  • Linux support.

CLI

Currently only Flutter plugin is published to the pub.dev.

For sending toasts from Dart console apps, you may do as follows for now.

git clone https://github.com/alexmercerind/desktoasts.git
cd desktoasts/cli/example
dart main.dart

Workings

Although, this might seem like a Flutter plugin, but this is internally based on FFI instead.

This section of the repository, contains C++ code that I compile to a shared library (which both Dart package & Flutter plugin pack along with them) for sending toasts.

Currently, features are limited. I definitely plan to improve upon this.

License

MIT License. Contributions welcomed.

Acknowledgements

Current package's functionality is solely based upon WinToast. Thanks to mohabouje.

You might also like...

Create Msix installer for flutter windows-build files.

Create Msix installer for flutter windows-build files.

Msix A command-line tool that create Msix installer for your flutter windows-build files. 📋 Install In your pubspec.yaml, add msix as a new dependenc

Dec 30, 2022

A cross-platform (Windows/macOS) scanner plugin for Flutter

quick_scanner A cross-platform (Windows/macOS) scanner plugin for Flutter Usage QuickScanner.startWatch(); var _scanners = await QuickScanner.getScan

Jun 10, 2022

A cross-platform (Android/Windows/macOS/Linux) USB plugin for Flutter

quick_usb A cross-platform (Android/Windows/macOS/Linux) USB plugin for Flutter Usage List devices List devices with additional description Get device

Oct 1, 2022

A cross-platform app ecosystem, bringing iMessage to Android, PC (Windows, Linux, & even macOS), and Web!

BlueBubbles Android App BlueBubbles is an open-source and cross-platform ecosystem of apps aimed to bring iMessage to Android, Windows, Linux, and mor

Jan 8, 2023

TinyPNG4Flutter - A TinyPNG Compress Image Desktop GUI For Flutter. Support macOS and windows

TinyPNG4Flutter - A TinyPNG Compress Image Desktop GUI For Flutter. Support macOS and windows

TinyPNG4Flutter A TinyPNG Compress Image Desktop GUI For Flutter. Support macOS

Dec 8, 2022

File picker plugin for Flutter, compatible with mobile (iOS & Android), Web, Desktop (Mac, Linux, Windows) platforms with Flutter Go support.

File picker plugin for Flutter, compatible with mobile (iOS & Android), Web, Desktop (Mac, Linux, Windows) platforms with Flutter Go support.

A package that allows you to use the native file explorer to pick single or multiple files, with extensions filtering support.

Jan 6, 2023

Ndiscopes - Scopes for NDI Sources in Windows

Ndiscopes - Scopes for NDI Sources in Windows

NDIScopes An open source Windows application to display several diffrent Scopes

Dec 18, 2022

Tabame is an alternative to Windows Taskbar. It also contains great tools such as advanced Hotkeys, QuickRun, Trktivity and Wizardly.

Tabame is an alternative to Windows Taskbar. It also contains great tools such as advanced Hotkeys, QuickRun, Trktivity and Wizardly.

Tabame 🤔 What is this app about? Main purpose of this app is to be a replacement for the Taskbar, but in meanwhile I've added more features that can

Jan 7, 2023

Biyi (比译) is a convenient translation and dictionary app written in dart / Flutter.

Biyi (比译) is a convenient translation and dictionary app written in dart / Flutter.

biyi_app Biyi is a convenient translation and dictionary app written in dart / Flutter. View document "Biyi" (比译) is the Chinese word for "Comparison

Jan 1, 2023
Comments
  • [Proposal] Use native source code instead of FFI

    [Proposal] Use native source code instead of FFI

    Hello, this library is great. It is the only library that supports Windows notifications.

    I have a few thoughts to talk about. I looked at your source code and directly packaged a desktoasts.dll, which was called by FFI on the Dart layer.

    I personally think that Flutter's FFI is mainly aimed at application, not package and plugin. In plugins, it is only a trick to call dynamic libraries through path splicing.

    Using FFI in a plug-in will cause many problems, and the most serious one I have found so far is the inability to coexist with the web platform. Of course, Dart has if (dart.library.ffi), but this operation needs to be done manually by the user, which is very bad, and this part of the code will also be compiled to other platforms.

    So I want to know, is it possible to implement this plug-in using platform source code? Instead of precompiled as a dynamic library

    enhancement 
    opened by ggdream 3
  • App shutting down on dismiss

    App shutting down on dismiss

    Hello,

    I am developing an application on Windows 10. The notification is working well, but whenever I click on the close button, send the notification to the notification center, open it and click on the close button again to totally dismiss the notification from the notification center the application crashes.

    I tried to make the notification not appear in the notification center using windows settings, but if I do it this way then the application will crash the first time I close and dismiss the notification.

    opened by Yanis01 0
  • What to specify in the appName, companyName and productName?

    What to specify in the appName, companyName and productName?

    Hi! Thank you for a such great component. Could you please tell, is it important what I pass to the ToastService(...) via appName, companyName and productName variables?

    My application started crashing on startup (when the ToastService is registered) after adding this component, but it doesn't crash every time I start it - only sometimes. I'm wondering if this could be due to the fact that the information passed to the ToastService is not reliable for Windows?

    I tried to run the app with the -v flag, however it's impossible to understand what's wrong with the app:

    [  +16 ms] 
       #0      throwToolExit (package:flutter_tools/src/base/common.dart:10:3)
       #1      RunCommand.runCommand (package:flutter_tools/src/commands/run.dart:663:9)
       
       #2      FlutterCommand.run. (package:flutter_tools/src/runner/flutter_command.dart:1043:27)
       
       #3      AppContext.run. (package:flutter_tools/src/base/context.dart:150:19)
       
       #4      CommandRunner.runCommand (package:args/command_runner.dart:196:13)
       
       #5      FlutterCommandRunner.runCommand. (package:flutter_tools/src/runner/flutter_command_runner.dart:284:9)
       
       #6      AppContext.run. (package:flutter_tools/src/base/context.dart:150:19)
       
       #7      FlutterCommandRunner.runCommand (package:flutter_tools/src/runner/flutter_command_runner.dart:232:5)
       
       #8      run.. (package:flutter_tools/runner.dart:62:9)
       
       #9      AppContext.run. (package:flutter_tools/src/base/context.dart:150:19)
       
       #10     main (package:flutter_tools/executable.dart:91:3)
       
    
    opened by alexursul 1
Owner
Hitesh Kumar Saini
Flutter & React.js developer. Writes C++, Dart, JS & Python. Maintains few utility libraries. Designs beautiful UIs.
Hitesh Kumar Saini
FFI binding generator

Binding generator for FFI bindings. Note: ffigen only supports parsing C headers. Example For some header file example.h: int sum(int a, int b); Add c

Dart 288 Dec 22, 2022
🎞 Flutter media playback, broadcast & recording library for Windows, Linux & macOS. Written in C++ using libVLC & libVLC++. (Both audio & video)

dart_vlc Flutter media playback, broadcast, recording & chromecast library for Windows, Linux & macOS. Written in C++ using libVLC & libVLC++. Install

Hitesh Kumar Saini 417 Dec 29, 2022
An 🎵 audio playback library for Flutter Desktop. Supports Windows & Linux. Based on miniaudio.

✒ libwinmedia is sequel to this project. It provides network playback, better format support, control & features. An audio playback library for Flutte

Hitesh Kumar Saini 50 Oct 31, 2022
Flutter on Windows, MacOS and Linux - based on Flutter Embedding, Go and GLFW.

go-flutter - A package that brings Flutter to the desktop Purpose Flutter allows you to build beautiful native apps on iOS and Android from a single c

null 5.5k Jan 6, 2023
A simple-to-use flutter update package for Windows, MacOS, and Linux.

Updat - The simple-to-use, flutter-based desktop update package Updat is a simple-to-use reliable flutter-native updater that handles your application

Eduardo M. 14 Dec 21, 2022
A pure Dart implementation of Firebase with initial support aimed at FlutterFire for Linux & Windows.

FlutterFire Desktop A work in progress pure Dart implementation of Firebase with initial support aimed at FlutterFire for Linux & Windows. A FlutterFi

Invertase 293 Jan 4, 2023
Flutter plugin for Flutter desktop(macOS/Linux/Windows) to change window size.

desktop_window Flutter plugin for Flutter desktop(macOS/Linux/Windows) to change window size. Usage import 'package:desktop_window/desktop_window.dart

ChunKoo Park 72 Dec 2, 2022
Flutter library for window blur & transparency effects for on Windows & Linux. 💙

flutter_acrylic Window blur & transparency effects for Flutter on Windows & Linux Installation Mention in your pubspec.yaml. dependencies: ... flu

Hitesh Kumar Saini 437 Dec 31, 2022
A Flutter plugin to read 🔖 metadata of 🎵 media files. Supports Windows, Linux & Android.

flutter_media_metadata A Flutter plugin to read metadata of media files. A part of Harmonoid open source project ?? Install Add in your pubspec.yaml.

Harmonoid 60 Dec 2, 2022
🎵 A cross-platform media playback library for C/C++ with good number of features (only Windows & Linux).

libwinmedia A cross-platform media playback library for C/C++ & Flutter with good number of features. Example A very simple example can be as follows.

Harmonoid 38 Nov 2, 2022