If building a cross-platform app is on your radar, you have yet another solution to consider: Kotlin Multiplatform.
As new development solutions enter the scene, it may be hard to decide which one will fit your needs best. In this article, we’re comparing Kotlin Multiplatform with the already well-established and loved Flutter. We outline the pros and cons of each solution and explain in which cases one will be more effective than the other.
Two tools for cross-platform app development projects
Kotlin Multiplatform and Flutter are both relatively young development tools created to support cross-platform projects. Each solution has its unique way of building cross-platform programs.
Flutter uses its own UI rendering engine based on Skia. Kotlin Multiplatform utilizes native development with scalability. Both of these approaches are greatly effective at creating well-performing apps for various platforms.
Let’s take a closer look at Flutter first.
What is Flutter?
Flutter is a relatively young UI framework - it was created by Google in 2017. It’s open source and offers a great documentation, as well as many tutorials and videos, which proves it was created with developers in mind. Flutter’s key architecture feature is its own rendering engine based on Skia.
Building applications in Flutter requires Dart (also created by Google back in 2011) - a statically typed language that offers numerous features of a modern programming language. The main purpose of Dart is to offer a client-optimized language for creating apps that run fast on any platform. It’s perfect for front-end development of mobile and web apps.
Flutter consists of two elements:
- An SDK, which includes the tools used to compile the code into native machine code (both Android and iOS).
- A UI library in the form of reusable widgets that can be personalized according to specific needs.
Flutter is a stable and reliable way to build secure and well performing applications - there are already ample examples of such apps on the market, including Google Ads, Google Pay, Reflectly, Alibaba or Postmuse.
Just like any other framework, Flutter has its pros and cons. We’ll start with the advantages.
Pros of Flutter
The Flutter team promises the framework will transform the app development process. It allows developers to build, test and deploy natively-compiled, multi-platform applications from a single codebase. A number of its advantages stem directly from the usage of Dart.
As long as you are comfortable using Dart, learning to use Flutter should be easy. The framework’s excellent documentation offers an easy start for any new developer, no matter what other platforms they have been using so far. In addition to that, creating a user interface in Flutter is intuitive and fast because of a well thought-through UI library as well as the descriptive aspects of Dart.
The hot-reload feature offered by Dart allows developers to see code changes in real-time and fix issues right away, without having to restart the application. Hot-reload can speed up development by reducing build and reload times, keeping developers more focused and productive - they can work in quick iterations and experiment without significant delays.
The feature is embedded in Flutter’s architecture; it doesn’t require any configuration. Do note, however, that the hot reload feature is unavailable for Flutter web development projects (in such cases, you will have to rely on hot restart, which loses the app state and requires full code recompilation).
Cost-reduction is one of the greatest advantages of Flutter. It allows you to create apps with fewer developers than you would have to engage in native development. However, this reduced headcount comes with a tradeoff: using native platform features in the development process can ultimately slow it down.
Flutter offers a constant 60 frames per second, which guarantees a smooth picture display. The latest update also introduced an algorithm that predicts the rendering complexity, which is then used to optimize memory usage without app performance loss.
On top of that, the rendering engine in Flutter optimizes the displayed user interface elements. Both features greatly stabilize application performance across various systems. In addition, Dart language compiles directly to native machine code without bridges that would slow down the performance.
Rich UI library
One of the innovative aspects of Flutter is that it offers ready-made widgets to create UIs. It has a consistent and unified object model in which every object is a widget (fonts, buttons and even padding), while most other products use different objects - layouts, views and controllers.
Flutter’s robust UI library allows developers to create beautiful, functional and adaptive user interfaces in a short time. The widgets themselves are highly customisable and follow both Android’s Material Design and Apple’s Cupertino guidelines.
Flutter began as a platform for creating cross-platform apps, but with the release of Flutter 3, the SDK was fully transformed from mobile-focused to platform-agnostic. The framework supports the five main operating systems: iOS, Android, Linux, macOS and Windows. In addition, Google is currently working to add more embedded systems, such as TVs or smart home appliances and more.
Cons of Flutter
A number of issues with Flutter have already been addressed during its evolution. Developers should keep these current drawbacks in mind:
Delayed UI additions
Because Flutter is based on its own rendering engine, all of the platform-specific widgets are implemented separately from the operating system’s built-in platform features. Consequently, when a new OS update is published, Flutter creators may need additional time to develop implementations of some of the features.
Rewriting apps upon migration
If you already have a functioning app created with native technology then migratinging to Flutter may require rewriting the whole application. In addition, developers may be confused about where to place the business logic and UI logic.
Not perfect with native solutions
Flutter is an intermediate layer in the structure of your apps. This means that Flutter apps that frequently make use native solutions tend to complicate the development process. They will also require more time to be developed.
What is Kotlin Multiplatform?
Kotlin Mutiplaftom is an SDK developed by JetBrains. It was first released in 2016, but it is still undergoing rapid development and many features are being added to every version.
The SDK is based on Kotlin language (also developed by JetBrains), a modern, statically-typed language that can be compiled to native platform code, Java Script or Java virtual machine code. It’s the preferred language for most Android developers.
Kotlin Multiplatform allows sharing code with variable intensity across various systems. Consequently, it allows to build not only cross-platform client applications and multi-platform libraries, but also full-stack applications that utilize shared code between frontend and backend.
This means that developers can decide which feature they want to implement as shared between platforms, and which should be implemented separately using native methods.
Pros of Kotlin Multiplatform
Instead of working as a new toolbox, Kotlin Multiplatform acts as an additional tool that follows a ‘shared business, native UI’ logic. This means that development teams can continue using their preferred toolchains. They can also benefit from:
Extensibility and customisation
You can scale an existing application with KMP. Kotlin Multiplatform allows programmers to implement features sharing common code or separately using native methods. It is a great way to allow for app scalability and use of news systems features.
To illustrate, if an Android and an iOS application already exist, and a certain new functionality needs to be added for both, this can be done in Kotlin Multiplatform to reduce the development time needed for implementation.
Cost-savings without compromises
With Kotlin Multiplatform, developers use a single codebase and implement features by sharing the data layer and business logic. The SDK also allows an easy implementation of specific functionalities through platform-specific APIs, so there are no compromises on their usage.
If you have a functioning native app, migratinging it to Kotlin Multiplatform is straightforward - developers won’t have to rewrite the whole app (which may have to be done if you opt for Flutter). Changes can be implemented iteratively, without modifying the UI, and they won’t incur additional costs during migration.
Experienced Kotlin developers
Kotlin is a multipurpose language that is a well-regarded choice for creating client applications as well as the backend. There are numerous experienced Kotlin developers available on the market.
Kotlin Multiplatform is very promising for cross-platform development. It can be used to create apps for mobile, desktop, web and backend. Its current state allows for creating apps with shared UI layers for most systems. There are plans to include more platforms in due time.
Cons of Kotlin Multiplatform
Kotlin Multiplatform is in beta version, which means that it is still in development that is focused on developers’ feedback. Nevertheless, changing versions should be simplified and not troublesome.
As Kotlin documentation states, the creators will try to minimize migration issues for developers. What is more, because it is a relatively new framework there are a limited number of external libraries. However, this number of libraries is growing everyday.
As in the case of most new projects, the documentation of Kotlin Multiplatform is currently minimal. This is probably going to change in the future, but at the moment development with Kotlin Multiplatform requires solving problems that no one has encountered yet.
The architecture in Kotlin Multiplatform isn’t yet well defined. Lack of clean structure can be troublesome at times, as most of the current architectural approaches haven’t been extensively tested yet and remain experimental. This disadvantage will certainly disappear with time.
When to choose Flutter over Kotlin Multiplatfrom
Flutter is perfect for creating new apps that do not require a lot of platform-specific code. It is extensively supported with external libraries, and offers a well-tested architecture as well as an excellent UI library.
All of this contributes to short development time, which is perfect for creating MVPs to test concepts in short time-to-market, as well as simple apps. The framework is an excellent choice for high-performing apps that offer common user experience across various systems.
A simple and clear MVP application for iOS and Android brought to life with Flutter by Netguru R&D department.
When to choose Kotlin Multiplatform over Flutter
Kotlin Multiplatform is perfect for creating new apps that might require a lot of platform-specific code. The SDK is a good choice when you need to migrate existing, natively developed apps thanks to the scalability of code sharing.
Migration can be performed iteratively. Scalability also ensures great performance even in case of complex features, so Kotlin Multiplatform is a good choice for larger projects. What is more, Kotlin Multiplatform is effective at creating apps that require natively implemented features alongside a shared codebase.
A retail app built in Kotlin Multiplatform by Netguru R&D department.
Choosing between Kotlin Multiplatform and Flutter
Both Kotlin Multiplatform and Flutter are state-of-the art technologies that support creating multi-platform apps. Selecting between the two is a matter of understanding your priorities.
Kotlin Multiplatform is in its early stage of development and has the potential to become a standard development cross-platform solution. It is still a great tool that can be used in multiple ways. It offers huge flexibility of code sharing and can speed up development without comprising usage of native features. If you’re going to expand your app and plan to use many native platform features in the future, opt for Kotlin.
Flutter is cost effective, well-tested and allows to develop apps fast without significant limitations. It’s being used to create increasingly complex apps. If time-to-market is your key project development factor and you can accept a dose of trouble when implementing platform-specific features, opt for Flutter.
At the same time, do bear in mind that it is possible to create a complex app in Flutter using native platform code and quickly launch apps with Kotlin Multiplatform to test the market.