'getting Unhandled Exception: Instance of '_CodecNotSupportedException'"while using flutter_sound package

I want to record audio while pressing a button. here is my code.

 var tempDir = await getTemporaryDirectory();
 String path = '${tempDir.path}/audio.acc';

await _myRecorder.openRecorder();
await _myRecorder.startRecorder(
                        toFile: path,
                        codec: Codec.aacMP4,
                      );

// after recording another button to stop the recording. to stop this recording i used the code:

await _myRecorder.stopRecorder();
_myRecorder.closeRecorder();
_myRecorder = null;

i get my above mentioned error while i call "await _myRecorder.startRecorder" function. please help. thank you.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source