A Dart package to send native 💬 toasts on Windows. Based on WinToast.

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.

Issues
  • [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
An 18 year old. Loves Flutter & React.js! Writes C++, JS, Python & Dart. Maintains few general purpose libraries. UI design enthusiast.
Hitesh Kumar Saini
Playground app for ZNN Dart SDK

Prerequisites Flutter SDK VS Code IDE recommended Installation Clone the repo git clone https://github.com/nemoryoliver/znn_playground.git Install pa

Oliver Martinez 9 Feb 16, 2022
free template opensource with minimal depends library flutter & dart

Project Name Sosial Media Donate ID: Jika Anda Menyukai karya saya dan ingin memberikan dana untuk saya membeli beberapa snack silahkan donasi seberap

Azka Full Snack Developer:) 33 Jan 1, 2022
This is a game tic tac toe made in Flutter&Dart

Tic Tac Toe Game A simple Flutter Tic tac toe game made for educational purpose. the main goal of this project is to teach the importance of data stru

null 1 Jan 25, 2022
Discord Rich Presence for Flutter & Dart.

dart_discord_rpc Discord Rich Presence for Flutter & Dart apps & games. Install Flutter dependencies: .. dart_discord_rpc: ^0.0.1 Dart CLI depende

Hitesh Kumar Saini 19 Jun 8, 2022
Repository for the App Dev Bootcamp conducted in Spring 2022 for IECSE. Bootcamp mainly focuses on Flutter and Dart.

IECSE-AppDev-Spring-2022 Welcome to IECSE's App Dev Bootcamp, Spring'22. Ever wondered how applications like Instagram, WhatsApp, and others are built

Divyansh Kulshreshtha 9 Jul 18, 2022
Serial Data Monitor is a multiplatform (Windows, Linux, Mac, ...) tool to interactively receive/edit/monitor data and send commands to an embedded system via the serial bus

See wiki for full documentation Serial Data Monitor Description Serial Data Monitor is a multiplatform (Windows, Linux, Mac, ...) tool to interactivel

monnoliv 4 Oct 29, 2021
Send virtual keyboard presses in godot on linux/windows

gdvk - Godot Virtual Keyboard Send virtual keyboard presses in godot on linux/windows Please inform me about how my code is shit; I'm new to C++. Comp

CrispyPin 3 Dec 30, 2021
C++ front-end package manager for embedding and redistributing with native applications

Pacm Simple C++ package manager Homepage: https://sourcey.com/pacm Documentation: https://sourcey.com/libsourcey/api-pacm/ Dependencies: LibSourcey (b

Sourcey 84 Jun 5, 2022
Plays native alert sound and shows native dialogs/alerts in your Flutter app.

flutter_platform_alert 2021 © Weizhong Yang a.k.a zonble. A simple plugin to present native alerts, including playing alert sounds and showing alert d

Weizhong Yang a.k.a zonble 55 Jul 23, 2022
Visual Studio native debugger extension to help debug native applications using Mono.

Unity Mixed Callstack UnityMixedCallstack is a Visual Studio 2017/2019 extension to help debug native applications embedding Mono, like Unity. If you

Unity Technologies 73 Aug 5, 2022
Send messages to a LED Matrix display through Telegram. Inspired by a tweet from Smarter Every Day

Send messages to a LED Matrix display through Telegram. Inspired by a tweet from Smarter Every Day

Brian Lough 22 Jun 13, 2022
Allows for multiple SwitchBot buttons and curtains to be controlled via MQTT sent to ESP32. ESP32 will send BLE commands to switchbots and return MQTT responses to the broker. Also supports Meter/Temp Sensor

SwitchBot-MQTT-BLE-ESP32 Switchbot local control using ESP32. no switchbot hub used/required. works with any smarthub that supports MQTT https://githu

null 278 Aug 10, 2022
First-up chord-send and tap-and-hold chord repeat extensions to QMK.

Quantum Mechanical Keyboard Firmware This is a keyboard firmware based on the tmk_keyboard firmware with some useful features for Atmel AVR and ARM co

Joshua Grams 7 Jul 19, 2022
A module for Godot 3.x that makes it easy to send crash reports to Backtrace

Godot Backtrace Module This module adds automatic crash generation support to Godot 3.x with the intent of making it possible to send the crash data t

null 12 Jul 21, 2022
Go through the readme... fork ....add....send a pull request .... get yourself in the contribution list...Plant the tree

Hacktoberfest 2021 Follow the README below to get started! Table of contents Getting Started The Process The Process star this repo Fork this reposito

Aditya Deshmukh 6 Jan 5, 2022
BokutachiHook - Hook for Lunatic Rave 2 to parse score data and send it to an HTTP server, made specifically for Bokutachi IR.

BokutachiHook Hook for Lunatic Rave 2 to parse score data and send it to an HTTP server, made specifically for Bokutachi IR (https://bokutachi.xyz). T

null 5 May 16, 2022
CredBandit - Proof of concept Beacon Object File (BOF) that uses static x64 syscalls to perform a complete in memory dump of a process and send that back through your already existing Beacon communication channel

CredBandit CredBandit is a proof of concept Beacon Object File (BOF) that uses static x64 syscalls to perform a complete in memory dump of a process a

anthemtotheego 161 Aug 5, 2022
Mirror only. Please do not send pull requests.

README - 08 March 2021 Welcome to the WebM VP8/VP9 Codec SDK! COMPILING THE APPLICATIONS/LIBRARIES: The build system used is similar to autotools.

WebM Project 741 Aug 10, 2022
ESPHome component to send and receive HDMI-CEC messages.

HDMI-CEC ESPHome Component An ESPHome component that supports receiving and transmitting HDMI-CEC messages to connected HDMI devices. The ultimate goa

John Boiles 19 Jul 29, 2022