Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

The method 'openAudioSession' isn't defined for the type 'FlutterSoundRecorder'

I am writing a flutter app for recording voice using flutter_sound package

environment:
  sdk: ">=2.15.1 <3.0.0"
dependencies:
  flutter:
    sdk: flutter

  cupertino_icons: ^1.0.2
  flutter_sound: ^9.1.2
  permission_handler: ^8.3.0
import 'package:flutter_sound/flutter_sound.dart';
import 'package:permission_handler/permission_handler.dart';
Future init() async {
    _audioRecorder = FlutterSoundRecorder();

    final status = await Permission.microphone.request();
    if (status != PermissionStatus.granted){
      throw RecordingPermissionException('Microphone permission denied.');
    }
    await _audioRecorder!.openAudioSession();
    _isRecorderInitiated = true;
 }

I am getting this error

The method 'openAudioSession' isn't defined for the type 'FlutterSoundRecorder'.

Can anybody help me in finding out what’s wrong with the code?

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

It seems to have been removed in version 9, but the documentation has not been updated. You can use openRecorder() instead or switch to an older version of the library.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading