progress property

Duration get 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;
}