Unable to record voice when using a flutter app on IOS

  1. Summary of my problem
    Unable to record voice when using the flutter app on IOS
  • Details about my goal
    I am working on a voice assistant app using Flutter. To record the speech and convert it to text, I am using Google speech to text API. The app works fine when I used it on an Android device but when I start using it on an iPhone, the recorder does not take the audio input. Error on the debug console is - AVAudioSession_iOS.mm:1149 Deactivating an audio session that has running I/O. All I/O should be stopped or paused prior to deactivating the audio session.
  • Expected Results
    Record the audio input and covert it into text
  • Actual Results
    Audio is not recorded hence the speech-to-text conversion is null.
  • Error Messages (if any)
    Error on the debug console is - AVAudioSession_iOS.mm:1149 Deactivating an audio session that has running I/O. All I/O should be stopped or paused prior to deactivating the audio session.
  1. What have I tried so far -
    I tried a bunch of suggested fixes -
  • setting the audio session to solo ambient.
  • added a duration of 5 -10 sec before the recorder.stop()
  1. Here’s the minimum code you would need to reproduce the problem -
    My code is similar to the example in google_speech | Flutter Package