23 October, 2020Read Time 4 min read

Getting started with Cross-Platform Mobile App Development

If you are at a developers’ event in Germany or Romania we are usually not far. Last year we were at the WeAreDevelopers Congress in Berlin and we were looking for that special something for our booth to connect with the visitors.

Tobias Schröder
Written by

Tobias Schröder Product Owner

Getting started with Cross-Platform Mobile App Development

What we came up with was a good old raffle.

To participate in the lottery we needed some kind of a simple quiz on our smartphones … or tablets … or laptops? That’s where my journey started. And after seven years I was once again looking into the way of writing apps. I did my last app for Android 2.x during my bachelor’s thesis in 2012 and, I think we all agree that seven years is quite a while in the world of frameworks and programming.

I wanted to code a small app, but I didn’t want to dig deep into frameworks or learn a new programming language for this rather small challenge. I wanted to keep things simple. For conferences we usually use iPads, and I did some Objective C programming in the past, but Swift is now the big thing. As I am working on a Linux distribution, developing any iOS App was not that easy. At that point I had to figure out which ways of creating an app were even possible. I had the following in my mind:

> Native Apps: I could write a native app directly for Android or iOS. But – as already mentioned – I am working on Linux distribution, so native iOS development wouldn’t be that easy... or even possible.

> Responsive website: I could do a responsive website so that I am free of any hardware choice. But then I would have to take care of a web server as well … and I wanted to keep it small and simple.

> Web App: Then there are those progressive web apps building on service workers that I already took a deeper look into, but somehow it would be a website again, right? (Remark: Progressive web apps are a type of a mobile app delivered through the web, built using common web technologies.)

> Cross-platform: Or finally I take a deeper look at the current cross-platform frameworks. Even if I have the gut feeling that they don’t feel right on the smartphone, they are maybe worth having a look at. It was obvious that I won’t develop a native app, because not only that I am not able to have a running Xcode (the IDE for developing iOS apps) on my machine, but also I wanted to include colleagues, whereby most of them also work with Linux distributions. Additionally the website and progressive web app was not an option for me. Even if writing a small and secure web server is not a big deal, I didn’t want to investigate how to get that server running outside and now be reachable not only inside our cluster – remember: I wanted to keep it small and simple. That’s why a cross-platform framework had to fulfill my needs. But which one should I take? PhoneGap, Xamarin, React Native? It seems that those frameworks are extremely volatile, new ones are being released on a regular basis, but I wanted to keep the app for a few more conferences rather than only that one taking place in Berlin.

Getting started with Cross-Platform Mobile App Development

At this point I decided to take a closer look at Google’s Flutter. It was unveiled at the Dart developer summit in 2015, which is not the game you play in your favorite pub. Dart itself is a client-optimized programming language for apps on multiple platforms and mainly developed by Google. You can use it to build mobile, desktop, backend and web applications. Its main characteristics are object-orientation, class definitions and garbage-collections in a C-style syntax that transcompiles optionally into JavaScript (see https://dart.dev/guides/language/language-tour#important-concepts and https://dart.dev/guides/language/sound-dart).

For me personally, it feels like a mix of JavaScript and JSON, but not in a bad way. If you are an object-oriented developer, you are going to like it, if you are more pragmatic and function-driven (like I am, who loves Clojure ♥) you will think that it’s bloated, but still … it’s nice.

Getting started with Cross-Platform Mobile App Development

As you can see in this example, we have a little stateless widget, which overrides the build method and returns a Material designed component. This component has different properties, which are objects again. Pretty straightforward, but somehow nested.

So the die was cast, Flutter it is. On the positive side I can say that Flutter is really easy to learn if you are familiar with JavaScript. It has a super smooth integration into Visual Studio Code and runs on every machine. You have hot code reload (awesome!!!) and you can do an MVP super fast - that’s somehow the raffle game I wanted to do (a simple quiz app isn’t so hard, is it?). Of course, you can have more benefits – as in other frameworks as well – like access to native features. Yet, no framework has this kind of great and official support from the Material Design team because Flutter is a Google initiative, but those were not the main points for me. On the other hand, Flutter only has a limited amount of libraries – compared to other frameworks. Every iOS widget is only a copy of the official iOS style guide, because Flutter cannot compile to a native iOS app, whereby it can compile so an Android apk.

As these tools get more advanced, the “code once, deploy twice” Holy Grail gets closer. Perhaps one day, we can really build an app once, and run it anywhere.