GlassQualityAdapter constructor
GlassQualityAdapter({
- required GlassQuality minQuality,
- required GlassQuality maxQuality,
- required int targetFrameMs,
- required bool allowStepUp,
- required void onQualityChanged(
- GlassQuality from,
- GlassQuality to
- GlassQuality? initialQuality,
- double warmupPremiumThresholdMs = 20.0,
- double warmupStandardThresholdMs = 28.0,
- void onWarmupComplete(
- GlassQuality settled,
- double p75Ms,
- int frames
Creates a GlassQualityAdapter.
onQualityChanged is called on the Dart main thread whenever the
effective quality changes. The callback receives (from, to).
initialQuality overrides both the session cache and Phase 2 — the
adapter skips the warm-up benchmark and jumps directly to Phase 3 using
the provided quality as its starting point. Use this to restore a quality
level previously persisted to storage (e.g. SharedPreferences) so
repeat launches skip the warm-up jank window entirely.
Implementation
GlassQualityAdapter({
required this.minQuality,
required this.maxQuality,
required this.targetFrameMs,
required this.allowStepUp,
required void Function(GlassQuality from, GlassQuality to) onQualityChanged,
this.initialQuality,
this.warmupPremiumThresholdMs = 20.0,
this.warmupStandardThresholdMs = 28.0,
void Function(GlassQuality settled, double p75Ms, int frames)?
onWarmupComplete,
}) : _onQualityChanged = onQualityChanged,
_onWarmupComplete = onWarmupComplete,
_currentQuality = maxQuality;