When to choose Flutter or KMM, and why the answer is always: it depends
Introduction
First up, let’s set the scene. Picture this: A FinTech company had a vision to design a native mobile app for iOS and Android platforms that will transform users into personal finance wizards — tracking spending, setting budget goals, investing, and transferring money, all at their fingertips.
After a not-so-brief flirtation with available technologies, Kotlin Multiplatform Mobile and our developers had a “meet-cute”. KMM won hearts because it allowed the team to script common business logic for both platforms in Kotlin — a language they had already wooed and won over. KMM promised native performance and UX for both platforms — a non-negotiable in the FinTech world where performance and security are like a good espresso, robust and intense.
Let the Journey begin!
Planning and Design
Our team began with a crystal-clear understanding of the business requirements and then designed a blueprint. They identified parts of the application that would share common business logic and those that would be platform-specific.
Implementation of common business logic
KMM enabled our team to write the common business logic in Kotlin. This part included exciting tasks such as managing user data, bank account operations, transactions, investments, and more.
Implementing platform-specific logic
Here, we got down to designing the user interface and other platform-specific features like push notifications, using native languages and tools for iOS and Android.
Testing and Improvement
We’re not ones to brag, but our testing was as comprehensive as a three-course meal. This included unit, integration, and functional testing.
Deployment and Support
Once we put the app through the wringer and it came out smiling, it was deployed on both platforms. The best part? It’s been regularly updated and improved.
Why not Flutter this time
While Flutter excels at fast prototyping and swiftly creating user interfaces with a single codebase, KMM stole the spotlight for a few solid reasons:
- Native Performance: KMM delivers native performance, essential for FinTech apps that need to be faster than a cat video going viral.
- Kotlin: Our team had already bonded with Kotlin, which eased any learning curve for KMM. Additionally, Kotlin is generally seen as more fashionable than Dart, Flutter’s language of choice.
- Integration with existing systems: Financial apps have no room for drama, and KMM made the integration process with existing systems as smooth as a Sinatra song.
- Native integration with device APIs: KMM better cooperates with native device APIs, providing us an advantage with every platform.
- Multi-threading support: KMM has a robust support system for multi-threading — a big plus for high-load apps like ours.
Now, don’t get me wrong, Flutter may still be the better match for different types of projects, especially those that need quick prototyping, have less complex performance requirements, or have teams that can converse in Dart better than in Kotlin.
While developing the app, we also turned a keen eye on features that needed a native touch — the camera, widgets, or Bluetooth.
Camera
If your app needs a camera for functions like document or QR code scanning, KMM gets two thumbs up.
Native Camera API Integration: KMM gets VIP access to native camera APIs on each platform. This means it can get creative with the camera’s features like different shooting modes, focus control, white balance, etc. In contrast, Flutter depends on third-party packages to support the camera, which may not always deliver the full range of features or keep up with the latest API updates.
Better Performance: With native access to the camera API, KMM can outperform Flutter when it comes to tasks such as image processing and analysis.
Better UI Control: KMM grants developers full control over the camera UI, allowing them to tailor it to the specific app requirements while maintaining a native look on any platform.
Widgets
Home screen widgets are the charm of mobile apps, offering users quick access to key info and features without opening the app. In this area, KMM trumps Flutter:
Native widget support: KMM speaks the native languages and tools for iOS and Android, guaranteeing full usage of native widget APIs. In contrast, Flutter lacks this native support and relies on libraries that may not always comply with iOS and Android UI guidelines.
Updates and maintenance: With KMM, refreshing your widgets with the latest OS updates is effortless. But with Flutter, you’re at the mercy of the library developers to keep pace with the latest changes, which can introduce issues.
Application integration: KMM integrates widgets with the rest of the app effortlessly, thanks to the shared code and tools. Conversely, Flutter may encounter difficulties because widgets need a different toolkit before integration with the rest of the app.
Bluetooth
Bluetooth is essential for many mobile apps, enabling smooth interactions with devices like headsets and smartwatches. Here’s why KMM takes the trophy in this round too:
Native Bluetooth API Support: KMM enjoys premium access to native Bluetooth APIs on each platform, allowing developers to fully exploit Bluetooth functionalities. On the other hand, Flutter relies on libraries that may lack the full suite of features and might experience stability or security issues.
Flutter and KMM Response Time
When I searched for a benchmark comparison between Flutter and a native app, I found nothing. So, I took matters into my hands and decided to conduct my test for responsiveness.
For the test, I employed the following set of tools:
- An Arduino Uno, capable of reading analog input several thousand times per second.
- A photoresistor was assigned the task of measuring screen brightness.
- A 1x1x1 cm aluminum block is used to simulate a tap on the screen.
- An Arduino-triggered relay, designed to alter the electrical capacitance of the aluminum block, thus emulating a screen tap.
I prepared the phone by affixing a photoresistor to the screen and setting an aluminum block on it. Then, I developed both a native app and a Flutter app, each programmed to change the background color from black to white upon touch. Additionally, I designed an algorithm that managed the relay, measured the time, and read the resistance from the photoresist.
Check it out:
Results
The native application was, on average, 28ms faster.
I believe this testing method is as reliable as possible — it simulates real-life application usage, from interaction to visible effect on the screen. It offers a transparent view of how both technologies perform.
There are other ways to measure the same. Flutter, Android Studio, and Xcode provide profiling tools that can time various operations. We can use Dart DevTools, Android Profiler, and Instruments in Xcode.
In Conclusion
Both KMM and Flutter have their strengths and weaknesses, and choosing the right framework is like picking the perfect ice cream flavor — it depends on individual project needs, developer tastes, and performance expectations.
KMM might be the perfect choice for those desiring a framework capable of creating apps with native performance while fully leveraging existing Kotlin libraries. Conversely, Flutter might attract developers aiming to create cross-platform applications rapidly and efficiently. Some sources suggest that Flutter can speed up the app development process by 30%-50%. Plus, it requires fewer team members for smaller projects, reducing project costs.
In the end, both KMM and Flutter have carved out their niches in the cross-platform applications market, continuing to prosper thanks to the support of their communities and parent companies. The decision between KMM or Flutter should be based on a comprehensive understanding of your project needs and the capabilities of both technologies.
Remember, picking the right tech stack is not about jumping on the latest trend — it’s about finding the perfect fit for your project needs. So, take your time, do your homework, and you’ll be on the path to building an application that users can’t resist!
No matter what you choose, the goal is the same: create a kickass app that users fall in love with.
Sources and similar articles
- https://www.netguru.com/blog/kotlin-multiplatform-vs-flutter
- https://volo.global/blog/news/flutter-vs-kotlin-multiplatform
- https://iteo.com/blog/post/flutter-vs-kotlin-multiplatform-do-they-really-compete/
- https://surf.dev/kotlin-multiplatform-vs-flutter-what-should-you-choose-to-build-a-software-project/
- https://medium.com/47billion/flutter-vs-kotlin-multiplatform-mobile-kotlin-native-vs-react-native-47billion-3ef6a174049c
- https://www.instabug.com/blog/flutter-vs-kotlin-mutliplatform-guide
- https://dev.to/tgloureiro/kotlin-multiplatform-vs-flutter-which-one-to-choose-for-your-apps-51oj
- https://doit.software/blog/flutter-vs-kotlin-which-is-best-for-cross-platform-app-development
- https://aglowiditsolutions.com/blog/kotlin-vs-flutter/
- https://flutter.dev/