`openRecorder()` and `closeRecorder()`

The τ Recorder API

openRecorder() and closeRecorder()

A recorder must be opened before used. Opening a recorder takes resources inside the OS. Those resources are freed with the verb closeRecorder().

You MUST ensure that the recorder has been closed when your widget is detached from the UI. Overload your widget’s dispose() method to close the recorder when your widget is disposed. In this way you will reset the player and clean up the device resources, but the recorder will be no longer usable.

closeRecorder() delete all the temporary files created with startRecorder()

void dispose()
        if (myRecorder != null)
            myPlayer = null;

You maynot openAudioSession many recorders without releasing them.

openRecorder() and closeRecorder() return Futures. You may not use your Recorder before the end of the initialization. So probably you will await the result of openRecorder(). This result is the Recorder itself, so that you can collapse instanciation and initialization together with myRecorder = await FlutterSoundPlayer().openRecorder();


    myRecorder = await FlutterSoundRecorder().openRecorder();

    (do something with myRecorder)

    myRecorder = null;
        Lorem ipsum ...

Tags: api recorder