position property Null safety

num position
override

Implementation

@override
num get position {
  if (_paused || _stopped || _audioElement == null) {
    return _position;
  } else {
    final currentTime = _audioElement!.currentTime;
    return (currentTime - _startTime).clamp(0.0, _duration);
  }
}
void position=(num value)
override

Implementation

@override
set position(num value) {
  final position = _loop ? value % _duration : value.clamp(0.0, _duration);
  if (_stopped) {
    // do nothing
  } else if (_paused || _audioElement == null) {
    _position = position;
  } else {
    _stopCompleteTimer();
    _position = position;
    _audioElement!.currentTime = _startTime + _position;
    _startCompleteTimer(_duration - _position);
  }
}