copyWith method

SystemAudioConfig copyWith({
  1. int? sampleRate,
  2. int? channels,
})

Creates a copy of this configuration with modified values.

Only the specified parameters will be changed; others remain the same.

Example:

final config = SystemAudioConfig(
  sampleRate: 16000,
  channels: 1,
);

// Change to stereo while keeping sample rate
final updated = config.copyWith(channels: 2);
// updated.sampleRate is still 16000

Implementation

SystemAudioConfig copyWith({
  int? sampleRate,
  int? channels,
}) {
  return SystemAudioConfig(
    sampleRate: sampleRate ?? this.sampleRate,
    channels: channels ?? this.channels,
  );
}