JSWritableStreamDefaultWriter extension

Is the object returned by WritableStream.getWriter and once created locks the writer to the WritableStream ensuring that no other streams can write to the underlying sink.

Example and more on MDN Web Docs

on

Properties

closed Future<void>

Available on WritableStreamDefaultWriter, provided by the JSWritableStreamDefaultWriter extension

Allows you to write code that responds to an end to the streaming process. Returns a Future that fulfills if the stream becomes closed, or rejects if the stream errors or the writer's lock is released.
no setter
desiredSize double?

Available on WritableStreamDefaultWriter, provided by the JSWritableStreamDefaultWriter extension

Returns the desired size required to fill the stream's internal queue. Note that this can be negative if the queue is over-full.
no setter
ready Future<void>

Available on WritableStreamDefaultWriter, provided by the JSWritableStreamDefaultWriter extension

Returns a Future that resolves when the desired size of the stream's internal queue transitions from non-positive to positive, signaling that it is no longer applying backpressure.
no setter

Methods

abort([String? reason]) Future<void>

Available on WritableStreamDefaultWriter, provided by the JSWritableStreamDefaultWriter extension

Aborts the stream, signaling that the producer can no longer successfully write to the stream and it is to be immediately moved to an error state, with any queued writes discarded.
close() Future<void>

Available on WritableStreamDefaultWriter, provided by the JSWritableStreamDefaultWriter extension

Closes the associated writable stream.
releaseLock() → void

Available on WritableStreamDefaultWriter, provided by the JSWritableStreamDefaultWriter extension

Releases the writer's lock on the corresponding stream. After the lock is released, the writer is no longer active. If the associated stream is errored when the lock is released, the writer will appear errored in the same way from now on; otherwise, the writer will appear closed.
write(Uint8List chunk) Future<void>

Available on WritableStreamDefaultWriter, provided by the JSWritableStreamDefaultWriter extension

Writes a passed chunk of data to a WritableStream and its underlying sink.