utils/glass_performance_monitor library

Glass Performance Monitor

A debug/profile-only tool that watches raster frame durations while GlassQuality.premium surfaces are active, emitting a single actionable FlutterError warning when the GPU budget is consistently exceeded.

Zero production overhead

The monitor never registers with SchedulerBinding in release builds. The kReleaseMode guard at start means no callbacks, no ring-buffer allocations, and no CPU cycles in shipped apps.

Usage

Enabled automatically when you pass enablePerformanceMonitor: true to LiquidGlassWidgets.initialize (which is the default in non-release builds). You can also control it manually:

GlassPerformanceMonitor.start();   // begin monitoring
GlassPerformanceMonitor.stop();    // stop and reset
GlassPerformanceMonitor.reset();   // clear warning latch, keep running

Classes

GlassPerformanceMonitor
Monitors raster frame durations and emits a developer warning when GlassQuality.premium surfaces are active and GPU budget is exceeded.
PremiumGlassTracker
Minimal stateful widget that tracks one premium glass surface's lifecycle with GlassPerformanceMonitor.