requestSample method
void
requestSample()
Schedules a single sample after the next frame.
Coalesces multiple requests; used for the initial verdict, trailing scroll-end samples, and external invalidation (e.g. the app theme changed). Sampling only happens when content is registered, so this is free on screens without a GlassContentAwareContent.
Implementation
void requestSample() {
if (_samplePending || !mounted) return;
_samplePending = true;
WidgetsBinding.instance.addPostFrameCallback((_) {
_samplePending = false;
unawaited(_sample());
});
// Make sure a frame actually comes — the screen may be fully idle.
WidgetsBinding.instance.ensureVisualUpdate();
}