getAverageFrameTime static method

Duration getAverageFrameTime()

Get average frame time

Implementation

static Duration getAverageFrameTime() {
  if (_frameTimes.isEmpty) return Duration.zero;

  final int totalMicroseconds = _frameTimes
      .fold(0, (sum, duration) => sum + duration.inMicroseconds);

  return Duration(microseconds: totalMicroseconds ~/ _frameTimes.length);
}