init method

Future<void> init({
  1. RecorderFormat format = RecorderFormat.s16,
  2. int channelCount = 2,
  3. int sampleRate = 44100,
})

Initializes the recorder. All parameters directly influence the amount of memory that recording will take.

channelCount must be in range 1..254 inclusive. sampleRate must be in range 8000..384000 inclusive.

Implementation

Future<void> init({
  RecorderFormat format = RecorderFormat.s16,
  int channelCount = 2,
  int sampleRate = 44100,
}) async {
  assert(1 <= channelCount && channelCount <= 254);
  assert(8000 <= sampleRate && sampleRate <= 384000);

  if (_isInit) return;

  await _recorder.init(
    sampleRate: sampleRate,
    channelCount: channelCount,
    format: format,
  );
  _isInit = true;
}