position property Null safety

num position
override

Implementation

@override
num get position {
  if (_paused || _stopped) {
    return _position;
  } else {
    final currentTime = WebAudioApiMixer.audioContext.currentTime!;
    final position = currentTime - _timeOffset;
    return _loop ? position % _duration : position.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) {
    _position = position;
  } else {
    paused = true;
    _position = position;
    paused = false;
  }
}