Skip to main content

DataChannel

Abstract widget-facing byte channel.

Inherits: abc.ABC

Methods

  • close - Release the channel.
  • on_bytes - Register a handler for bytes pushed from Dart.
  • send - Send bytes Python → Dart.

Methods

closeabstractmethod

close() -> None

Release the channel. Idempotent.

on_bytesabstractmethod

on_bytes(
    handler: Callable[[bytes], None] | None,
) -> None

Register a handler for bytes pushed from Dart. Pass None to clear. The handler runs synchronously on whatever thread the transport delivers from — push heavy work to a queue/worker.

sendabstractmethod

send(payload: bytes) -> None

Send bytes Python → Dart. Fire-and-forget.