progress property

Duration progress

How long the track been has been playing, as a Duration

If the track is playing: how much had been played at the time the state was recorded, plus elapsed time since then

If the track is not playing: how much had been played at the time the state was recorded

Implementation

Duration get progress {
  if (state == NowPlayingState.playing) return _position + DateTime.now().difference(_createdAt);
  return _position;
}