I am trying to get the duration of an audio file and set it to a String. I am using flutter_sound plugin to play the sound. onPlayerStateChanged listen has duration but I don't know how to use it to set a String to duration value without playing the sound.
The main aim is I want to select an audio file which has a Max length of 20 sec. Can anyone please help me solve it?