positionPercent property

double get positionPercent

Returns the current playback position in percentage.

Implementation

double get positionPercent {
  if (position == Duration.zero || duration == Duration.zero) {
    return 0.0;
  } else {
    final value = position.inMilliseconds / duration.inMilliseconds;
    return value.clamp(0.0, 1.0);
  }
}