StutterDetectStrategy constructor

StutterDetectStrategy({
  1. Duration stutterThreshold = _defaultStutterThreshold,
  2. void onStutterDetected(
    1. StutterInfo info
    )?,
  3. @visibleForTesting int nowMillisProvider()?,
})

创建卡顿检测策略

stutterThreshold Loading duration threshold for stutter detection. Defaults to 500ms. onStutterDetected Optional callback for stutter events. nowMillisProvider 时间源,必须返回正值(默认 DateTime.now().millisecondsSinceEpoch)。

Implementation

StutterDetectStrategy({
  this.stutterThreshold = _defaultStutterThreshold,
  this.onStutterDetected,
  @visibleForTesting int Function()? nowMillisProvider,
}) : _nowMillisProvider = nowMillisProvider ?? _defaultNowMillis {
  assert(
    nowMillisProvider == null || nowMillisProvider() > 0,
    'nowMillisProvider must return positive values',
  );
}