AudioWaveform constructor

AudioWaveform({
  1. Key? key,
  2. required List<double> samples,
  3. required double height,
  4. required double width,
  5. Duration? maxDuration,
  6. Duration? elapsedDuration,
  7. required bool showActiveWaveform,
  8. bool absolute = false,
  9. bool invert = false,
})

Constructor for AudioWaveform

Implementation

AudioWaveform({
  Key? key,
  required this.samples,
  required this.height,
  required this.width,
  this.maxDuration,
  this.elapsedDuration,
  required this.showActiveWaveform,
  this.absolute = false,
  this.invert = false,
})  : assert(
        debugMaxandElapsedDuration(
          maxDuration,
          elapsedDuration,
        ),
        'Both maxDuration and elapsedDuration must be provided.',
      ),
      assert(
        maxDuration == null ? true : maxDuration.inMilliseconds > 0,
        'maxDuration must be greater than 0',
      ),
      assert(
        elapsedDuration == null ? true : elapsedDuration.inMilliseconds >= 0,
        'maxDuration must be greater than 0',
      ),
      assert(
        elapsedDuration == null || maxDuration == null
            ? true
            : elapsedDuration.inMilliseconds <= maxDuration.inMilliseconds,
        'elapsedDuration must be less than or equal to maxDuration',
      ),
      waveformAlignment = absolute
          ? invert
              ? WaveformAlignment.top
              : WaveformAlignment.bottom
          : WaveformAlignment.center,
      super(key: key);