transports_udp (1.0.0)
Published 2026-09-12 03:51:24 +00:00 by Platform
Installation
dart pub add transports_udp:1.0.0 --hosted-url=About this package
UDP transport implementing package:transports, with a lightweight reliability layer (dart:io RawDatagramSocket).
Dart.Package.Transports.Udp
UDP transport implementing
Dart.Package.Transports
on dart:io (RawDatagramSocket) — ported from
CSharp.Package.Transports.Udp.
VM-only — raw sockets don't exist on Flutter web. Use
Dart.Package.Transports.Websocket
for anything that needs to run in a browser.
Reliability layer
UDP itself is unordered and lossy. DeliveryMode.unreliable sends go out
as bare datagrams. DeliveryMode.reliable sends add a small
stop-and-wait-style layer on top, matching the C# transport:
- Each packet is
[flags: byte][sequence: uint32 LE][payload]. - A reliable packet is ACKed by the receiver and retransmitted by the sender (every 500ms, up to 5 times) until acked.
- Out-of-order reliable packets are buffered and released once the gap is filled, so handlers always see reliable data in send order.
- A connection idle for 30s is dropped with
DisconnectReason.timeout.
Max payload per send is maxUdpPayloadSize (1395 bytes) — there's no
fragmentation layer, matching the C# transport.
Versioning and publishing
Version.txt is the exact version that gets published — a push to main
publishes it only when that version isn't on the feed yet. Pushes to any
other branch only resolve and test.