how to automaticaly start recording once you are inside the page?

Viewed 23

i have a audio recording page which starts when i tapin the button and stop when i tap the button once again

ElevatedButton(
          child: Icon(
            recorder.isRecording ? Icons.stop : Icons.mic,
            size: 80,
          ),
          onPressed: () async {
            if (recorder.isRecording) {
              await stop();
              context.pop();
            } else {
              await record();
            }
            setState(() {});
          },

how can I automatically start recording once I open the audio recording page and tap it to stop and tap again to start?

I tried to put the record function in initstate but it didn't work

void initState() {
         super.initState(); 
         initRecorder(); 
         record(); 

}

0 Answers
Related