Time to float: the experience of a native Android developer in a week of attempts on Flutter

Higor Ernandes
Level Up Coding
Published in
7 min readApr 1, 2020

--

Hello my fellow quarantined and unsure-of-your-own-future-don’t-know-if-I’ll-ever-go-to-a-bar-again developers! Today I want to get in touch with you to share a little bit of my catastrophic experience in moving from native Kotlin/Swift development to Flutter in mobile development.

Fist of all I want to make sure you have in mind that this text is a completely biased and partial opinion filled with disgust, pain and a little bit of hate. I am not here to advocate in favor of Flutter. I’m here to express my feelings, which right now are at least 60% affected by all the chaos going on in the world. I want to be clear about how much I love Kotlin/Swift, about how much I wish I could code everything in my life using them, and about how much Dart sucks.

Yes, I am using Flutter as the scapegoat for my psychological issues. Sue me.

I love it.

Also, have in mind that this whole opinion might completely change by the end of the week.

Reasons why I’m doing this with my life

Existential crisis: I hate myself and death is inevitable. Therefore, I want every sip of the remaining growler of craft beer in my fridge to taste the best possible. To achieve that I’m forcing the rest of my life to be completely miserable, resulting on the beer tasting better. To achieve that misery, here I am learning Flutter.

Market adequation: some jerks are apparently using it and some other morons are hiring jerks to build stupid apps using it, and it’s apparently a good idea to join them otherwise in not so much time I won’t be able to provide food for myself or finance any of my filthy addictions.

Timing: we are a small team and we need a fast solution up and running for Android and iOS.

The case

Right now I work for a gamification company which has clients with large teams and we need to build a manager app so managers from these teams can have easy access to their subordinate’s performance indicators. Flutter showed up as a solution and I gathered in this article some of the many points of concern we had before making a decision on using it or not, so the next person to work in this knows where I left off. I’m considering we have a few weeks before Brazil completely collapses and I become unavailable due to death, and that’s why I’m preparing.

Enough with the optimism and let’s move on to the issues.

Visual layout creation

It simply doesn’t exist and that is one of the saddest thing I could ever imagine. That’s sadder than your dog looking at you go to work every day and expecting you to never come back.

Layout in Flutter is built using Widgets, which is a bunch of crappy nested code that looks like the computational version of all the available spaghetti in the world rotting in an olympic swimming pool for a whole week, not to the point of having rats but to the point of accumulating small crawling animals that grow wings later.

For comparison, I added the code for defining a Dialog in Kotlin:

It is so small I could tattoo this on my eyelid in Comic Sans 72 and would still have spare space for a mandala.

And the code for defining the exact same Dialog in Dart/Flutter:

This language should be impeached.

And now you’re gonna say “yeah but the second dialog has a lot more properties and is a lot more complete, that’s unfair” but then I ask you: is that the real point here?

No.

The point here is to exaggerate, use non-reliable data and express anger. Keep that in mind.

Scientific analysis aside, Flutter needs some serious shit together getting so it becomes a little bit less hatable in terms of interface building. Fortunately, God himself has sent some good souls who work sharing coded words of wisdom for the greater good of humanity. Flutter Studio is an online tool that does exactly what a microwave, an online banking app or a gallon full of coke in the trunk of the car to clean blood from your victims of murder does: it saves time.

Flutter Studio. How come people have the amazing idea for a fully functional cross-platform mobile framework but can’t think of a thing like this. It’s like knowing how make a perfectly symmetric 3-floor wedding cake full of fancy ornaments but not knowing how to fry an egg.

Flutter Studio allows you to structure most of the visual components of the screen and export the generated code as files you can just add to your project, completing them with your business logic, service calls and animations. It gives you the blessing of letting you build your layouts without having to touch any of the dirty stuff. It is like a cleaning glove for developers.

After a cure and a vaccine for coronavirus, I sincerely hope that the next big evolution for all humans living right now is a built-in interface builder for the Flutter platform. That and a fairer economic system.

HTTP Calls

As someone coming from native Android development and used to use Retrofit on a daily basis, this part of the experience wasn’t so hurtful. Partly because as the days pass you feel less and less pain from being alive (as you get used to it), partly because Retrofit is available in Flutter.

However, the most common HTTP call library for Flutter is Chopper. They probably got that name from an analogy to how the information is chopped into packets and sent from one computer to another in an HTTP request, or because Chopper reminds of onions, which reminds of crying, which is what you do when coding in Dart. Either way, nice work.

Chopper and Retrofit use interfaces and annotations to define endpoints, both have interceptors and support every mainstream network request/response handling. With a bit of work and some tutorials like these you can easily add Json serializers and your API layer will be just as good as any other.

Oh who am I kidding, easy my ass. I lost almost two whole days to get this shit working.

Design patterns

From my research, Flutter supports some good and loved design patterns largely used in native mobile development such as MVVM; some bad and hated design patterns largely used in native mobile development such as and MVP; and then there’s BloC.

Just a diagram from the BloC library documentation so you think I have actually studied anything.

BloC seems to be the most common, civilised, enlightened, polite and cultured approach (but only because it looks like MVVM and reminds me of the iOS mechanics). Although mapping events with enums look a little bit weird to me, the concepts look as beautiful as a kitten. The codes I have looked at make me wanna throw up on this very same kitten and make it eat it. That is mainly because of Dart though, I’ll get through it.

Animations

Haven’t done many. However I did found that Lottie is available in Flutter so you can rest assured that you’ll be able to run the cute animations you stole from a poor hardworking Dribbble designer on your completely original and non-cribbed app’s success screens. No one will ever notice.

I did try Lottie for Flutter though. After spending about 3 minutes on 1) setting up the library, 2) hooking up the code for an animation, 3) integrating it with a service call and about 9 fucking hours and 17 fucking minutes on 4) trying to figure out what should be the correct path for the animation file, I managed to get this humble result:

Looks crappy because it’s a GIF but it works, trust me. Also, don’t mind the squared button, it’s a work in progress.

There’s also a bunch of built-in controls for animations that I didn’t dive into but that I‘ve seen available (transitions, fade, shape, all that crap the UX people think is possible in their fantasious heads and much more). Lurk a bit too, don’t leave it all to me.

Conclusion

As stated by either Robert Ludlum or Suzane Collins in The Hunger Games (couldn’t find the actual author of the sentence in my extensive 5 minute search and I don’t care): “hope is the only thing stronger than fear”. I hope the women and men behind the Flutter project are planning to reduce the fear they’re causing in people coming from Kotlin/Swift by adding a either a visual, a voice-activated, a hand drawn, a smell-oriented or whatever-sense-you-choose-to-use interface builder to the Flutter framework, because we’re in 2020 and after taking high definition pictures of Pluto and sending a piece of spacecraft so far outside the solar system we even lost track of it, I don’t believe that coding from scratch is still the best way to build a fucking phone app screen. What do you guys think I am, a developer? For God’s sake.

Disclaimer: no information in this article is true. I don’t represent or own nothing but the disgust for myself. People from Google or any other people related to any of the tools mentioned here: please don’t sue me. Thanks for providing me means to acquire food. I love you all.

--

--

Mobile Engineer, amateur musician, writer and drawer (mostly in boring meetings).