Play sound on timer - Flutter

i’m building a countdown with alarm, i use audioplayers library for the sound, i try to play a beep sound at different moments, so i tried this code :

when timer == “00:50” ? play sound : timer

it is logic that i got this error : type ‘Future’ is not a subtype of type 'String’ . but i didn’t find the solution , this is what i want :

when timer == “00:50” && “00:40” && “00:30” && “00:20” ? play sound : timer

this is my code :

                     return Text(
                        timer == "00:50"
                       : timer,
                            style: TextStyle(
                              fontWeight: FontWeight.w200,
                              color: Colors.white,
                              fontSize: 100.0,

This is the error causing line, you see the Text widget is expecting a String, but you have passed it"bip.wav") which has a return type of Future. Thats why you are getting the error.

Instead you should add the Play action in your get function like this:

  String get timer {
Duration duration =
    animationController.duration * animationController.value;
 if(timer == "00:50")'bip.wav')               
return "${(duration.inMinutes).toString().padLeft(2,'0')}:${(duration.inSeconds % 60).toString().padLeft(2, '0')}";


your proposition didn’t work , i finaly find a way but it didn’t work properly,
this is the code that works

                  animation: animationController,
                  builder: (_, Widget child) {
                    if (timer == "00:55")'audio/bip.wav');
                    return Text(timer);

when i restart the app the media stop working and it gives me this error :

E/MediaPlayerNative( 6964): Unable to create media player
E/AudioplayersPlugin( 6964): Unexpected error!
E/AudioplayersPlugin( 6964): java.lang.RuntimeException: Unable to access resource 

any suggestion ??
Thank you so much !