question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

I need Help for :

  • Using the API ?

Here is my question :

I have this part of the code where I expect the stop icon to change to play icon when the player finished playing the file.

                                   IconButton(
                                      onPressed: () async {
                                        if (_isPlaying) {
                                          _isPlaying = false;
                                          setState(() {});
                                          await audioPlayer.stopPlaying();
                                        } else {
                                          _isPlaying = true;
                                          _fileNamePlaying = entry.fileName;
                                          setState(() {});
                                          await audioPlayer
                                              .play(entry.fileName);
                                          _isPlaying = false;
                                          setState(() {});
                                        }
                                      },
                                      icon: Icon(
                                          _isPlaying &&
                                                  _fileNamePlaying ==
                                                      entry.fileName
                                              ? Icons.stop
                                              : Icons.arrow_right,
                                          size: 30)),

For some reason await audioPlayer.play(entry.fileName); doesn’t wait and executes the rest of the code thus the play icon changes to to stop and play immediately. I need the setState to run after the file is finished playing… I appreciate if someone could help. Thanks.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:29

github_iconTop GitHub Comments

1reaction
Larpouxcommented, Jan 31, 2022

😄

Just click on the “likes” button on top of pub.dev.

I am really happy when people are pleased by my work. Take care.

0reactions
Sefericommented, Jan 31, 2022

Now that worked… I’d really suggest adding this parameter type info to the docs as well. Or on android studio when hovered over the method… It’s very confusing. Now how can i buy you a beer mate ? Donate to the project ?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Help Definition & Meaning - Merriam-Webster
verb ; a · to be of use to : benefit. will do anything to help their cause ; b · to further...
Read more >
The Beatles - Help! - YouTube
Music video by The Beatles performing Help !. © 2015 Calderstone Productions Limited (a division of Universal Music Group) / Subafilms ...
Read more >
HELP | definition in the Cambridge English Dictionary
help meaning: 1. to make it possible or easier for someone to do something, by doing part of the work yourself or…. Learn...
Read more >
Help Definition & Meaning | Dictionary.com
to make easier or less difficult; contribute to; facilitate: The exercise of restraint is certain to help the achievement of peace.
Read more >
Help! - Wikipedia
Help ! is the fifth studio album by the English rock band the Beatles and the soundtrack to their film of the same...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found