copyWith method

PlaybackState copyWith({
  1. AudioPlaybackState? state,
  2. AudioTrack? currentTrack,
  3. Duration? position,
  4. Duration? duration,
  5. Duration? bufferedPosition,
  6. double? volume,
  7. double? speed,
  8. ShuffleMode? shuffleMode,
  9. RepeatMode? repeatMode,
  10. bool? isBuffering,
  11. AudioLoadingState? loadingState,
  12. AudioCacheState? cacheState,
  13. int? currentIndex,
  14. String? errorMessage,
  15. Map<String, dynamic>? extra,
})

Creates a copy of this state with the specified properties changed.

Implementation

PlaybackState copyWith({
  AudioPlaybackState? state,
  AudioTrack? currentTrack,
  Duration? position,
  Duration? duration,
  Duration? bufferedPosition,
  double? volume,
  double? speed,
  ShuffleMode? shuffleMode,
  RepeatMode? repeatMode,
  bool? isBuffering,
  AudioLoadingState? loadingState,
  AudioCacheState? cacheState,
  int? currentIndex,
  String? errorMessage,
  Map<String, dynamic>? extra,
}) {
  return PlaybackState(
    state: state ?? this.state,
    currentTrack: currentTrack ?? this.currentTrack,
    position: position ?? this.position,
    duration: duration ?? this.duration,
    bufferedPosition: bufferedPosition ?? this.bufferedPosition,
    volume: volume ?? this.volume,
    speed: speed ?? this.speed,
    shuffleMode: shuffleMode ?? this.shuffleMode,
    repeatMode: repeatMode ?? this.repeatMode,
    isBuffering: isBuffering ?? this.isBuffering,
    loadingState: loadingState ?? this.loadingState,
    cacheState: cacheState ?? this.cacheState,
    currentIndex: currentIndex ?? this.currentIndex,
    errorMessage: errorMessage ?? this.errorMessage,
    extra: extra ?? this.extra,
  );
}