holdMeasurement static method
Suspends frame measurement, for every adapter, until the returned hold (and every other open hold) is released.
Use it around heavy work of your own that competes with the glass for the GPU/CPU, so the slowdown is not mistaken for a device that cannot render the glass:
final hold = GlassAdaptiveScope.holdMeasurement();
try {
await heavyWork();
} finally {
hold.release();
}
Frames reported while a hold is open count toward neither the warm-up benchmark nor runtime degradation. After the last hold is released, settleFramesAfterHold further frames are dropped before measuring resumes. Holds nest, and are safe to open when no adapter exists.
Implementation
static GlassMeasurementHold holdMeasurement() {
_holds++;
return GlassMeasurementHold._();
}