configure method Null safety

Future<void> configure(
  1. AudioSessionConfiguration configuration
)

Configures the audio session. It is useful to call this method during your app's initialisation before you start playing or recording any audio. However, you may also call this method afterwards to change the current configuration at any time.

Implementation

Future<void> configure(AudioSessionConfiguration configuration) async {
  await _avAudioSession?.setCategory(
    configuration.avAudioSessionCategory,
    configuration.avAudioSessionCategoryOptions,
    configuration.avAudioSessionMode,
    configuration.avAudioSessionRouteSharingPolicy,
  );
  _configuration = configuration;
  try {
    await _channel.invokeMethod('setConfiguration', [configuration.toJson()]);
  } catch (e) {
    // Unsupported platform - ignore.
  }
}