Automate That Shit

Picture this, you are beginning to learn dart. But, you do not have enough money yet to pay for your own continuous server service for your mobile app builds. Would it not be nice to have a way to automate some of the work of app development so you can spend all your time on learning dart and flutter? I am going to show you how to use a dart plugin that requires no knowledge of dart to automate some of your app development workflow.
And, it’s freaking painless and awesome!
Pre-Requirements
I am using a dart plugin called, derry. It’s not the dart plugin named grinder that Google came up with but it requires no dart coding unlike grinder and thus is reachable to you when you first start learning both dart and flutter. From your terminal type:
flutter pub global activate derry
And flutter will run than give your terminal prompt back so you know it’s installed:

The next item we need is to add a script node to our pubsepc yaml file:
script: derry.yaml
You will add that right at the end of your pubspec yaml file. Now let me explain some Derry Concepts which than you will use to create your first derry yaml file and than run your first derry script.
Derry Concepts
The first concept goes back to what flutter is, ie cross-platform. Thus, in derry we specify all the script nodes by platform of win64, mac64, and linux64. Let me show you an example:
prepdir:
win64:
- mkdir reports\uml
- mkdir reports\coverage
- mkdir reports\test
mac64:
- mkdir reports/uml
- mkdir reports/coverage
- mkdir reports/test
linux64:
- mkdir reports/uml
- mkdir reports/coverage
- mkdir reports/test
That’s just my project prep sub-command sequence that I am creating. And so in my terminal as part of my project creation I can call:
derry prepdir win64
To get my project prepare sequence of things executed the way it should be done on MS Windows. Any time that there will be a difference in how to do shell commands platform wise you have to use a manual platform block as derry by itself will not do the translations between bash shell and powershell.
The 2nd concept is that each item in the script list is a separate process. In other words it’s more efficient if I re-write my prepdir set of sub-commands as:
prepdir:
win64:
scripts:
- mkdir reports\uml
- mkdir reports\coverage
- mkdir reports\test
as that than means I am doing this in MS Windows PowerShell:
mkdir reports\uml && mkdir reports\coverage && mkdir reports\test
The 3rd concept is that you can combine sub-commands as list items in another sub-command script node. Let me show a very brief example. Let me show the sub-command script node for the test node:
test:
win64:
- flutter test --machine | tojunit -o reports\test\karma-test.xml
mac64:
- flutter test --machine | tojunit -o reports/test/karma-test.xml
linux64:
- flutter test --machine | tojunit -o reports/test/karma-test.xml
Now I can call that in my build sub-command script node like this:
build:
- $test
And than I can run that just by typing in my terminal:
derry build
Now that is the short version as I did not show my junit2html processing step to turn that produced xml unit test file into some readable html content. But you get the idea. And a brief side note, I do not use xslt to transform my xml stuff to html as that takes too long instead I use some python and perl scripts that accomplish that without resorting to using xslt. That way I only have one process that takes longest besides the actual app build itself; ie the api docs generation phase.
Also note, that the build sub-command script node name is not always the actual full build app compile process. In fact because of the way I use my IDE I generally only have the accessory sub-command scripts listed in my build node as generally most of the time I run my actual app compile form my IDE and not from my derry terminal command sequences. My point being that derry is flexible enough that you can do it any way you like.
SIDE NOTE: A peek into some of my creative process. I found this way neat writing tool this morning, called zettlr! To give you an idea:

It’s a dedicated Zettle Note writing app put out by Hendrick Erz and several other contributors and the project page is at:
https://www.zettlr.com/
It’s really a great time saver for all the note writing and other writing I do daily.
Conclusion
With this simple dart derry plugin you can automate some of the tasks of your flutter app development without having to know dart right away. And that means you can set up some good developer habits such as using code metrics feedback of test results, code coverage, etc to ease your deep dive into learning both dart and flutter.
Resources
Specific to the article:
DerryPlugin@pub.dev https://pub.dev/packages/derry
GNUBashManual https://www.gnu.org/software/bash/manual/
MSPowerShellDocs https://docs.microsoft.com/en-us/powershell/
General Flutter and Dart resources:
Flutter Community Resources https://flutter.dev/community
Flutter SDK https://flutter.dev/docs/get-started/install
Android Studio IDE https://developer.android.com/studio
MS’s Visual Studio Code https://code.visualstudio.com/
Flutter Docs https://flutter.dev/docs
Dart Docs https://dart.dev/guides
Google Firebase Mobile Device TestLab https://firebase.google.com/docs/test-lab
Trademark Notice
Google LLC owns the following trademarks; Dart, Flutter, Android, Roboto, Noto. Apple Inc owns the trademarks iOS, MacOSX, Swift, and ObjectiveC. Apple Inc owns trademarks to their fonts of SF Pro, Sf Compact, SF mono, and New York. JetBeans Inc owns the trademarks to JetBeans, IntelliJ, and Kotlin. Oracle Inc owns the Java trademark. Microsoft Inc owns the trademarks to MS Windows OS and Powershell. Gradle is a trademark of Gradle Inc. The Git Project owns the trademark to Git. Linux Foundation owns the trademark to Linux. SmartPhone OME’s own trademarks to their mobile phone product names. To the best of my ability I follow the brand and usage guidelines with the above mentioned trademarks.
About Fred Grott
I’m the crazy SOB who as a former android mobile developer is starting to write about flutter mobile app development, design, and life(see Eff COVID and GOP https://fredgrott.medium.com/eff-covid-and-the-gop-e912db0548b8). Will I reach the pivotal One Million Medium monthly viewers mark? Sit-back and watch it happen. Find me on these social platforms: