transports (1.1.0)
Published 2026-09-12 04:08:46 +00:00 by Platform
Installation
dart pub add transports:1.1.0 --hosted-url=About this package
Transport-agnostic networking abstractions: Transport, TransportConnection, delivery modes, and batching.
Dart.Package.Transports
Transport-agnostic networking abstractions — ported from
CSharp.Package.Transports:
Transport (batched sends on a flush timer), TransportConnection,
TransportListener/TransportConnector capability interfaces, delivery
modes, and connection/error event types.
This package has no concrete transport. Pick one:
Dart.Package.Transports.Websocket
(works everywhere, including Flutter web), or, for dart:io-only targets,
Dart.Package.Transports.Tcp /
Dart.Package.Transports.Udp.
API shape
Transport— abstract base. Queues sends and flushes them atupdateFrequency(default 30Hz) viasendBatch, unlessenableBatchingisfalse. ExposesonDataReceived,onConnectionDisconnected,onTransportErrorstreams.TransportConnection—id,state,remoteEndPoint,stateChanged.TransportListener/TransportConnector—listen(endpoint)/connect(endpoint)plus their accepted/connected streams. A transport usually implements both.TransportEndPoint,ConnectionState,DeliveryMode,DisconnectReason,TransportState— value types shared by every transport.
Differences from the C# original
- C# events (
+=/-=) become broadcastStreams. CancellationTokenparameters are dropped; Dart networking code doesn't use them idiomatically.- The C# base
Transport.SendBatchconcatenates queued messages into one frame by default. No concrete transport actually uses that path — TCP and UDP need per-message length prefixes, WebSocket needs one frame per message — so this port's defaultsendBatchsends each message individually instead of replicating unreachable behavior.
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.
Details
Assets (1)
Versions (2)
View all
1.1.0.tar.gz
5.4 KiB