raptorq_flutter

A thin Flutter wrapper around the raptorq Rust crate (RaptorQ, RFC 6330). It was made so the BlastQR app could use raptorq from Flutter, and exposes little more than the crate itself.

The Dart bindings are generated with flutter_rust_bridge, and the Rust code is built with Dart build hooks.

Supports Android, iOS, macOS, Linux and Windows. Not web.

Requirements

The Rust code is compiled when your app builds, so you need Rust installed with rustup and Flutter 3.41 or newer.

Usage

await RaptorQFlutter.init();

final encoder = await RaptorQEncoder.newInstance(data: bytes, mtu: 1280);
final oti = encoder.oti();
final packets = await encoder.getEncodedPackets(repairPacketsPerBlock: 10);

final decoder = await RaptorQDecoder.newInstance(oti: oti);
Uint8List? result;
for (final packet in packets) {
  result = await decoder.addPacket(packet: packet);
  if (result != null) break;
}

For streaming, sourcePackets and repairPackets return packets in ranges.

Input is not validated. Malformed packets, a mismatched ObjectTransmissionInfo, or repairPackets past maxRepairPackets() can throw a PanicException or give wrong output.

License

MIT. raptorq is licensed under Apache-2.0.

Libraries

raptorq_flutter
RaptorQ (RFC 6330) fountain code encoding and decoding for Flutter.