0

I know it may be goofy for some of you, but I really would like to get a notification or a sound when my flutter application has compiled and is running. I would like to automate this process but I don't know where to start or if exists any option to do so?

I have been suggested to use a .sh file to automate execution but It won't show the useful toolbar in VSC.

Thanks in advance for your help.

Esteban Muñoz
  • 308
  • 2
  • 7

1 Answers1

0

This is simple. There will be many ways you can achieve this.

Simplest way is a bash script.

Step 1.

Create a file "execute_build.sh" in the same directory as your application. It can be anywhere but if its elsewhere you need to "cd" to that directory which is a long way.

Let's say we have execute_build.sh in same level as pubspec.yaml.

Now. Inside that simple add this line.

flutter build apk --release

This line can be any release command.

After that line on the next one this bellow line.

say "I am done"

Note this would work if you are on Mac os. But you can add your own system command based from here: In a bash script/command how can I make a PC beep noise, or play a sound file?

Since Bash Script execute line by line this second command will only get executed while the above is finished.

So Second Line Can be anything. It can be a http request using grep to a hook in Slack, Teams. It can be another python or command that does something else.

To execute this bash script all you have to do is Write bash execute_build.sh in the terminal of the IDE or VS Code.

Krish Bhanushali
  • 1,594
  • 1
  • 8
  • 16
  • I think this is a good idea, I had to be more specific. As I'm using VSC this displays a toolbar once the application start to compile, using ´flutter run´ in the terminal won't display this toolbar. – Esteban Muñoz Jun 03 '23 at 04:02