positionStream property Null safety

Stream<Duration> positionStream

A stream tracking the current position of this player, suitable for animating a seek bar. To ensure a smooth animation, this stream emits values more frequently on short items where the seek bar moves more quickly, and less frequenly on long items where the seek bar moves more slowly. The interval between each update will be no quicker than once every 16ms and no slower than once every 200ms.

See createPositionStream for more control over the stream parameters.

Implementation

Stream<Duration> get positionStream {
  if (_positionSubject == null) {
    _positionSubject = BehaviorSubject<Duration>();
    if (!_disposed) {
      _positionSubject!.addStream(createPositionStream(
          steps: 800,
          minPeriod: Duration(milliseconds: 16),
          maxPeriod: Duration(milliseconds: 200)));
    }
  }
  return _positionSubject!.stream;
}