lost property

  1. @override
Stream<DeviceLoss> get lost
override

Each time the device stops working: a WebGPU device lost, a WebGL context lost or restored. An external source, so a Stream.

What a loss means for the caller. Every handle this device made is spent; a frame drawn after it draws nothing. A DeviceLoss that DeviceLoss.isRecoverable (a WebGL context that the browser restores) is followed by another event with DeviceLoss.restored true, after which the application rebuilds its renderer on the same device; any other loss means opening a new device.

Every backend's, not WebGL's alone. This is the one place a caller learns of a loss, whichever backend it opened, so each backend reports here whatever its API lets it see: WebGPU its device.lost and the errors it would otherwise only log, WebGL its context events, Impeller and the software rasteriser at least their own dispose as DeviceLossReason.destroyed. A caller listens once, on whatever it opened, and never asks which backend it was. A backend from outside this repository owes the same; the empty default is only what one inherits before it says anything, and it reads as "never lost".

Implementation

@override
Stream<DeviceLoss> get lost => _lost.stream;