I’ve tried both Kotlin with XML and Flutter, which one is harder?

Mario Gunawan
3 min readMar 18, 2023

--

Harder in the context of developing mobile applications. For kotlin, I can only give you an example the old library using XML and not the new compose library.

Kotlin is harder. Definitely.

There are several reasons why android development using Kotlin is harder than Flutter. I’ll start with the simplest example

Code required to render this screen

In Kotlin with XML, it requires at least 2 files (XML and the Kotlin activity) and a lot of boilerplate codes.

In flutter, you just need around 7 lines of code to do that. And it looks already better.

In my experience, this is true no matter which stage of the app you’re developing. Kotlin with XML always requires you to write more code than flutter.

SDK Complexity

For those who don’t know, SDK means software development kit. In this context, SDK refers to the kit we used to write app in kotlin/flutter.

To develop a “clean” application using Kotlin with XML, we need to understand a lot of concepts such as: view binding, data binding, view model, view holder, adapter, etc. Most of the concepts relates to binding data from the view (XML) to the code. Also, you need to memorize a lot of functions when you develop your app (e.g. onOptionItemSelected , fragment has onCreate , onCreateView , onViewCreated separately which is also different from how the activity works, etc.)

Most of the data binding concepts don’t exist in flutter, mainly because both the view and logic in flutter are written using dart. This allows us to switch between logic and view seamlessly. Other than that, the one function we need to memorize to create widgets are the build , or the initState function if we need some processing before our view is created.

Debugging

As a developer, bugs always happen. In Kotlin (both with XML and compose), debugging is harder than it is in flutter mainly because of 2 reasons:

  • Without going into detail, the debugging tool in Flutter is much better
  • Kotlin SDK doesn’t have hot reload unlike flutter
    Hot reload refers to reloading the app with the changes that occur in the code. The process is faster than re-running the app every time changes happen.

As a beginner, and even as an intermediate developer, it’s easy to make mistakes. With the help of Flutter debugging tools, it’s easier to debug compared to Kotlin.

Language Complexity

Kotlin Android SDK is created using the Kotlin language (duh) meanwhile Flutter is created using dart. In the case of language complexity, I think both language offers their own set of problems. In my first few weeks of learning flutter, it was really annoying to see an error just because I uses a final instead of const (trust me this’ll happen often). There are other cases like understanding the super call, or the required annotation. So I’d say Flutter have a pretty steep learning curve.

Kotlin on the other hand, doesn’t have a lot of “surprises” I barely learned any Kotlin language before developing using it and I rarely found any problems with its language. However, some of the higher-level concepts like coroutine, callback functions, the by annotation is less intuitive to understand.

In summary, I believe Kotlin is easier to digest for a beginner with some unique concepts while Dart is harder to learn but is easier to make sense for more experienced developers.

And… that’s why if you’re looking to start learning, I’d recommend you to start with flutter and then try Kotlin afterward since it’s easier to develop with flutter. Even the Kotlin development team is now pushing the compose SDK (flutter-like way to build an app) to new developers since they realized more and more people are moving to flutter. But, I have no experience using the android compose SDK so if someone have any idea, I’d love to have a discussion.

That’s all. See ya!

--

--

Mario Gunawan

I'm a passionate mobile / web developer. Writing articles about software development, mainly about flutter and react.