averageFrameTime property

Duration? get averageFrameTime

Get average frame time over the sample window

Implementation

Duration? get averageFrameTime {
  if (_frameTimes.isEmpty) return null;

  final totalDuration = _frameTimes.fold<Duration>(
    Duration.zero,
    (prev, current) => prev + current,
  );

  return Duration(
    microseconds: totalDuration.inMicroseconds ~/ _frameTimes.length,
  );
}