position property Null safety

Duration position

The current position of the player.

Implementation

Duration get position {
  if (playing && processingState == ProcessingState.ready) {
    final result = _playbackEvent.updatePosition +
        (DateTime.now().difference(_playbackEvent.updateTime)) * speed;
    return _playbackEvent.duration == null ||
            result <= _playbackEvent.duration!
        ? result
        : _playbackEvent.duration!;
  } else {
    return _playbackEvent.updatePosition;
  }
}