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 at updateFrequency (default 30Hz) via sendBatch, unless enableBatching is false. Exposes onDataReceived, onConnectionDisconnected, onTransportError streams.
  • 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 broadcast Streams.
  • CancellationToken parameters are dropped; Dart networking code doesn't use them idiomatically.
  • The C# base Transport.SendBatch concatenates 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 default sendBatch sends 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
Pub
2026-09-12 04:08:46 +00:00
708
5.4 KiB
Assets (1)
1.1.0.tar.gz 5.4 KiB
Versions (2) View all
1.1.0 2026-09-12
1.0.0 2026-09-12