Skip to content

Latest commit

 

History

History
46 lines (33 loc) · 1.39 KB

README.md

File metadata and controls

46 lines (33 loc) · 1.39 KB

Magic Wormhole for Dart

⚠ This plugin is a work in progress, use at your own risk ⚠

A flutter plugin that wraps wormhole-william into a Dart API.

Supported functionality

  • Send/Receive files
  • Send/Receive text

Examples

Sending files:

final client = Client();
client.sendFile(File("/home/user/hello.txt")).then((codegenResult) {
  print("Enter ${codegenResult.code} to receive the file");
});

Receiving files:

final client = Client();
final download = client.recvFile("1-revenue-gazelle");
download.pendingDownload.accept(File("/home/user/${download.pendingDownload.fileName}"));
download.done.then((result) {
  print("Received file ${download.pendingDownload.fileName}");
});

Building

Currently this plugin is only buildable as part of the build for this app.

Known Issues

Dart does not support callbacks from wormhole-william from multiple threads. The plugin implements function calls by sending the arguments to a Dart send port and handling the messages to resolve on Dart. The C stack is kept in a busy loop until the dart function is completed. Once this issue is resolved, we can cleanup that code to be much simpler and less error prone.