Flutter First Impressions From a Backend Dev
Flutter First Impressions From a Backend Dev on PopOs
I recently took a contract to refresh a flutter app that needed some library and permissions updates to be released on the Play store.
I ran into a few things that were good and a few things that took me a minute to figure out, so I wanted to give a quick overview of how I got started.
I come from a very vim and terminal kind of workflow, I was worried that needing Android Studio (which you do) would be uncomfortable. I hear that you could potentially use virtualbox in lieu of the emulator packaged with Android Studio, but I did enjoy the IntelliJ completion and refactoring tools. This contract was also more of a versioning update with the handful of language changes and new permissions required by recent versions of the Android platform (I targeted Android 34). Which is to say that I didn’t really bother checking into the vim bindings. I mostly used my own terminal, since much of the Android Studio tools generate terminal commands. This was useful to discover some new commands in the ecosystem cuz aint nobody got time for all them docs. Google is far better than say, Amazon in terms of it’s information to obvious advertisement and manipulation ratio, but still.
System Requirements
I first started this contract on my more portable laptop with 8GB memory and 4 cpus. Running the emulator was unworkably slow. My other machine has 16GB with the same count of 4 cpu and the emulator was able to reliably cold boot and have a usable framerate when running.
Mycroft Parking is basically a notes app with a gps feature. Needing that much horsepower to boot was a little surprising.
I tend to avoid needing so much tooling, but the fact that this could render to many platforms is interesting. I’ll report back when I have more than one target deployed to.
Android Studio seemed happier when I installed it on the cleaner, larger machine. I think I had a few old versions of Java or something holding my tooling back. I might recommend starting with a machine that doesn’t have too many other dependency / package stuff going on from system wide applications.
Installing and System Health
Flutter and Dart have a lot of moving parts. Before you start, make sure you have a working system with:
flutter doctor
- Chromium works great on PopOs
The newest Java 21 does not work with Kotlin, so use the older 17.
I got similarly locked into gradle 8.0.2 as 8.1 and on were incompatable with a thing I forgot to note.
Static Analysis
Before I moved to the faster machine, I was able to get much of the work I needed to do by running:
flutter analyze
About 120 bugs I needed to address were surfaced through static analysis. Mostly about a change in the language requiring explicit null safety handling. This is way way faster than booting the emulator and compiling to that target.
When I first started, I assumed you needed to run the app on the device somehow. That’s mostly true, but you can do a fair bit without having to run the emulator by static analysis. Dart is a typed language and comes with all that compile-time convenience.
I found myself giving an estimate to my client and noting that my past experience with such languages give you a lot of up-front errors, then less when you actually try to use it. This played out the way I expected! Yay Types!
Actually Running It
flutter run lib/main.dart
This has flutter connect to any of the potential targets like a website, an android app and I will soon be able to get back to you about an iOS app.
Luckily there were only a very small handful of things I needed to work on in the front end. The language that flutter uses seems fairly ideosyncratic in terms of widgets, how they nest and their APIs. They could have just used HTML5 or something, but then I think that would just be React Native.
Runtime Bugs
There were a dozen or so runtime bugs in the app once I got it booted. There were some new things like a new type of color palatte that I made up colors for. There was a timer that I needed to request permissions to use. I believe Android did not require the app to request a permission to emit a notification before.
Building a Release
flutter build apk
failing cuz storeFile
Signing and Deploying the apk to the Play Store
I had a little grief at first getting my keys set up to upload. I thought I had downloaded the old key from the console, but only had gotten the digest. The old developer had left the organization, so a new key was needed to replace it. I created my own and uploaded it.
I point to it in my key.properties
file:
storeFile=/path/to/upload-keystore.jks
storePassword=P@SS
keyPassword=P@SS
keyAlias=upload
Using App Bundle
I had only used apk files so far, but apparently app bundles are the new hotness?
flutter build appbundle
Addressing Android Versions
I had never worked with Android development before this project, so I was naively greedy in upgrading the version to API 34. I’m used to web development, anything older than a few hours is automatically refreshed. The versions for Android releases were more spread out than I expected! Here’s a good plot to current demographics.
I needed to back off my version a bit to include more users.
Conclusion
Neato.
Heavy.
Much Java.
I think I would reach for React Native if given the choice for a new project, but the dart language is fun to work in! I love functional programming and the type system felt very productive.
I ended up being in a position where anywhere I had logging, the app had no bugs. But when I pushed it to production it was unresponsive. I’m suspicious of the change from apk to app bundle, but unfortunately my contract came to a close over communication between us and Google.
While I was fixing the app, Google ended up closing down the account due to inactivity. They had moved the deadline dates around before, and this was in conflict with their communications and my own activity on the account. I definitely downloaded a version from the play store, so calling the account inactive feels unfair. I’ve had a similar experience when ghosted after a months long interview process.
Ultimately I needed to hand off the project to a developer more experienced with the play store.
When it’s back up, please check out Mycroft Parking!