A mobile application’s User Interface is a critical part of the system. The app development landscape is swarming with technologies and solutions for creating UIs. Alongside native developments, there is a variety of cross-platform, web, hybrid and even codeless tools for building application interfaces. Android is, by the number of active devices worldwide, the undisputed market leader.
Table of Contents
- Flutter vs native Android
- New vs seasoned
- Native Android SDK
- Flutter SDK
- Kotlin vs Java
- Prime choice
- Dart for Flutter
- Thread safety
- Bottom Line
- Native vs cross-platform
Today we put native Android app development against (also) Google’s own, brand new, cross-platform framework.
Flutter vs native Android
Ok, so you must’ve heard about Flutter by now – the latest cross-platform app development SDK. According to Google- its proud parent, it’s a complete set of tools and solutions to develop awesome mobile apps. The idea of using a single tech stack to build User Interfaces for different mobile platforms (this day and age – just iOS and Android) is as exciting for developers as it is attractive for businesses wanting to give their customers top mobile experience. With native mobile app development becoming increasingly more expensive, it’s natural for the market to look for cost effective alternatives. The internet loves comparisons, so let’s match Flutter against its big brother – Android.
Was it worth it for Google to create a competitive UI building tool set to their fully established, 13 year old SDK? Let’s break the two down a little bit, and see what they’re all about.
New vs seasoned
Choosing between native Android and Flutter is not simple. Neither is a one-size-fit-all solution. It would be impossible to suggest one or the other without first analyzing particular project’s requirements. Native Android holds the age advantage and with Kotlin, offers a near inexhaustible range of solutions to even most complex issues. Writing a native app with Kotlin gives you access to the latest Android hardware improvements, compatibility across a variety of Android based devices and a highest attainable quality and performance.
Cross-platform Flutter tempts with the promise of getting two (Android and iOS) native applications, writing a single, Dart code base for both apps. Flutter should prove an effective UI building tool for relatively simple projects, especially useful for developing fetch-and-display type apps, where the mobile app interacts with the server for crucial User activities. Adding the attractiveness is Flutter’s own rendering engine, with which great UI quality can be achieved, making Flutter usable in social media or data management mobile apps. Flutter has a solid set of UI building tools to create beautiful, fast and fluid layouts.
Native Android SDK
Android SDK is arguably the world’s most popular mobile software development kit. Since its conception in 2007, it’s been constantly developed and improved to facilitate support for a great variety of devices, and to keep up the growing market needs and expectations. For 10 years it’s been (officially) a solely Java-based platform, but in 2017 received a major upgrade. At the 2017 Google i/O, Kotlin was announced as Android’s officially supported programming language, and a year later became recommended first choice for mobile app development. Android community’s reception of this announcement is best shown in this clip from 2017 https://www.youtube.com/watch?v=ukm_RXxw4Yc
The event audience’s reaction reflects that of the entire community’s, as after a decade of purely Java-based apps, a breath of fresh air into Android SDK was long overdue.
Flutter Initial release coincides with Kotlin’s rise to fame. Google launched their own cross platform UI SDK, promising “Beautiful native apps in record time”, with flair and thorough preparation. The tech giant’s offering in the growing market of cross platform technologies was received with a lot of excitement. Google’s Flutter team made sure they introduced as nothing short of a groundbreaking and top-of-the-line tech for everyone. Since the 2017 official launch Flutter managed to catch up in popularity with the to-date cross-platform leader – Facebook’s React Native.
Now a look into both platforms’ languages – Kotlin and Dart. Let’s see what switching from Java has done for Android, and if Flutter really benefits from introducing a new programming language into the mobile app development landscape.
Kotlin vs Java
Java is after all a language of superb versatility. It lets you build backends, frontends, native mobile and desktop apps, has a vast community support and a number of 3rd party libraries. Jackson, Dagger or Joda Time are but a few examples of solutions known and used in all kinds of projects.
Introducing Kotlin into the native Android development landscape was a huge success mainly for its practically full interoperability with Java and the fact that it sped up and streamlined the implementation of native Android mobile apps.
By now, Kotlin has already established itself as the top-choice language in the native Android ecosystem, so there’s no point elaborating on Java here. If you’re developing an app in 2020, you’re going with Kotlin anyway. If you are adding new functionalities to your existing, Java-written software, it’s Kotlin as well.
To me, moving to Kotlin was a smooth and pleasant transition. Smart integration with Android SDK, and beautifully designed syntax lets me write more verbose, shorter code. Every field is non-null by default, reducing the number of unexpected null pointer errors.
Delegation patterns are built in the language grammar. Data storage classes can be declared explicitly, and the compiler takes care of the generic boilerplate code for data access. Functions are prioritized, which makes incorporating functional programming techniques quite easy.
Aside from standard thread switching, Kotlin offers coroutines – an async/await pattern. It gives the programmer the possibility to suspend execution of certain pieces of code, without blocking the thread. It also changes the syntax of asynchronous code, eliminating the need for callbacks and enabling top to bottom execution of programs, as in the case of synchronous ones.
Dart and Flutter
Introduction of a new language for Flutter came as a surprise. Although Dart has been around since 2011, it’s had (initially) a mixed reception. Google team’s choice of Dart as base for creating Flutter apps was a risky decision, but they did approach it with due diligence. Flutter Favorites program was introduced by the Flutter team to encourage the rapidly growing community to create and maintain libraries expanding the language’s functionality and streamlining working with Dart. The initiative promotes and rewards the best solutions posted on the pub.dev website. The number of available packages keeps growing, and the developers’ peace of mind along with it.
Same goes for the variables. Functions are treated as first-class so it’s easy to use functional concepts. Dart also offers some syntactic treats, like cascade notation, which enables writing sequences of operations on a single object as one, fluid statement. Code can be reused with Mixins, simplifying class hierarchization. In order to solve the issue of null safety, null-aware operators are used. They relieve the programmer of checking for nulls and defining fallback data.
Dart supports asynchrony with the async/await pattern, making writing asynchronous code similar to synchronous programming. Results can be handled by both Futures and Streams so there is no need for libraries like ReactiveX for simple asynchronous tasks (you can still use RxDart if you need it). Another important thing about Dart’s asynchrony is its single-threaded execution model. By default, all code runs in the main UI thread and every async/await operation goes into suspension without blocking the thread. In order to perform heavy computations which could put heavy load on the processor, an Isolate can be used. It is a separate execution thread that doesn’t share memory with other Isolates. This way, thread safety is prioritized in Dart, making writing asynchronous tasks simple and idiomatic.
Kotlin and Dart are useful and quite straightforward. They utilise a modern syntax relieving programmers of the burden of null-checking and complicated thread management. Dart is a bit simpler than Kotlin, the latter being more of a Android apps developers’ Swiss army knife. Kotlin improves native development with a number of syntactic treats and advanced asynchrony options with coroutines.
Native vs cross-platform
Native Android apps developed using Kotlin offer state-of-the-art User Experience and are a no-compromise choice for quality and performance. If your business is in need of cutting-edge mobile experience, be it for consumers or your internal processes, native development is a strong recommendation. This goes especially for big, established enterprises wanting top-notch, problem-free mobile app to stun the market and outshine the competition.
cross-platform development offers a number of other advantages – lower cost, faster time to market, Google support, etc…, and if applied to the right type of project, will result in high-quality, marketable mobile product.
Would you like to know more about differences between cross-platform and native app development? Download our ebook! It is the ultimate guide to Cross-Platform vs Native development. You will find out more about native applications, cross-platform applications and technologies used to build them.
What Is Software Outsourcing and How Much Does it Cost?
Top 4 technologies to develop your app in 2020
Cypress Test Automation Tool – Automate Software Testing
Flutter vs React Native – cross-platform frameworks comparison