setSkipSilenceEnabled method Null safety

Future<void> setSkipSilenceEnabled(
  1. bool enabled
)

Sets whether silence should be skipped in audio playback. (Currently Android only).

Implementation

Future<void> setSkipSilenceEnabled(bool enabled) async {
  if (_disposed) return;
  final previouslyEnabled = skipSilenceEnabled;
  if (enabled == previouslyEnabled) return;
  _skipSilenceEnabledSubject.add(enabled);
  try {
    await (await _platform)
        .setSkipSilence(SetSkipSilenceRequest(enabled: enabled));
  } catch (e) {
    _skipSilenceEnabledSubject.add(previouslyEnabled);
    rethrow;
  }
}