GKPerformanceManager class
Monitors frame performance and adjusts GKQuality dynamically.
Tracks frame times using a rolling window of the last 60 frames. When the average FPS drops below 80% of targetFps for 2 seconds, quality is downgraded. When it stays above 95% for 5 seconds, quality is upgraded.
Access via the singleton GKPerformanceManager.instance.
{@tool snippet}
// Record a frame each tick:
GKPerformanceManager.instance.recordFrame();
// Listen for quality changes:
GKPerformanceManager.instance.qualityStream.listen((quality) {
print('Quality changed to $quality');
});
{@end-tool}
Properties
- averageFps → double
-
The rolling average FPS over the last
_windowSizeframes.no setter - currentQuality → GKQuality
-
The current rendering quality tier.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
-
qualityStream
→ Stream<
GKQuality> -
Stream that emits when currentQuality changes.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- targetFps ↔ int
-
The target frame rate (default 60).
getter/setter pair
Methods
-
dispose(
) → void - Releases resources. After calling this, the singleton should not be used again.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
recordFrame(
) → void - Records a single frame and updates quality if necessary.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Properties
- instance → GKPerformanceManager
-
The global singleton instance.
final