Menu

1 / 3

How we send files over QR codes: a fountain code, a 30x faster encoder and a camera pipeline in Flutter

DEV Community: dart·Zincir X·about 21 hours ago
#Ugz4x6sb
#devtodart#devto#dev#frame#code
Reading 0:00
15s threshold

Originally published on the Magical Share blog .

The whole path, from file to file. Steps 1 to 3 run on the sending screen, 4 to 6 on the receiving phone.

Magical Share sends files between nearby devices with nothing but light. One screen plays a stream of QR codes, and a phone camera reads them back into the file. There is no Wi-Fi, Bluetooth or internet anywhere in the path. The product walkthrough shows it from the user's side, and the web app lets you try sending from a browser.

This post is about the engineering. A camera pointed at a screen is a noisy, one-way channel, and four problems decide whether it works:

The receiver misses frames: motion blur, glare, autofocus, a hand that wobbles.

The sender has to draw about 60 large QR codes a second, including in a browser on a single thread.

The phone has to decode them at camera speed.

Anyone in the room can film the screen.

Everything below is Dart and Flutter, running on Android, iPhone, macOS and the web from one codebase.

Why a fountain…

Continue reading — create a free account

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