mobile development with Flutter

The mobile development market is rapidly gaining momentum in recent years. In 2019, it is expected that it will cover 2.5 billion users and more than 80 billion dollars with the prospect of further growth. Gradually, there have been formed three key niches, which are the development for Android, iOS and cross-platform solutions, that determine the market further development. The latter emerged as a way to quickly create applications for both dominant platforms, sacrificing the power of native development. The most famous solutions in this area were PhoneGap by Adobe, Xamarin by Microsoft, React Native by Facebook. In 2017, Google joined the group by introducing its Flutter framework at the annual Google I/O Conference. In December 2018, the stable version of Flutter was released, which turned it from an experimental SDK into a fully suitable for a commercial development tool.

However, each tool has its own strengths and weaknesses. Their understanding is extremely necessary in order to make the right choice and get the optimal cost-result ratio.

The benefits of using Flutter to create mobile apps

1.Free and open source

The SDK does not require the cost of buying a license and provides a full range of opportunities for adding the missing functionality to the project repository https://github.com/flutter/flutter.

2.Save development time with a cross-platform approach

Like all other tools for hybrid and cross-platform development, Flutter makes it possible to develop for both mobile systems at once, reducing the total development time and synchronizing the appearance of new versions of the application for Android and iOS.

3.Inherent graphics library

Flutter uses the Skia – built-in library for rendering. This makes it more platform-independent. The SDK provides a rich set of widgets, in particular, the Material and Cupertino collections for rendering native-like widgets for Android and iOS. By combining various widgets, you get the opportunity to create a complex UI. Thanks to its own library, Flutter applications look the same on different versions of operating systems. Thus it is good to solve one of the main problems of mobile development today – the great variability of mobile devices.

In this example, we create a Floating Action Button with icon and text.

In addition to the predictable UI, you also get a more productive application. Hybrid applications (such as PhoneGap or Ionic) use WebView for rendering graphics, which has terrible performance and differs from the native look. React Native is built on converting bridges of its widgets into native ones. This increases the load on the device’s resources and can also cause rendering problems. Skia guarantees the correct behavior of the UI.

4.Hot reload

One of the drawbacks of compiled languages before scripting languages is the loss of time for building a project. With frequent edits, it can take up a substantial part of the working time. The Flutter Hot Reload feature allows you to display the effect of your edits in the code immediately.

5.Powerful community

Of course, one of the SDK’s greatest strengths is its rapidly growing community. Thanks to the efforts of Google and enthusiasts, Flutter has well-structured documentation and examples of the implementation of the main tasks of mobile development. The main platforms for the exchange of experience are presented on the resource https://flutter.dev/community.

6.Development prospects for Fuchsia OS

Flutter is currently the only tool for creating applications for the Fuchsia OS from Google. For several years now, the new operating system has aroused the interest of developers and questions about its purpose. Particularly ardent fans call it the “Android killer,” which should blur the line between mobile, desktop and web development. At Google itself, the new operating system is evaluated more restrainedly – as a testing ground for testing new ideas and experiments. Nevertheless, with the further development of Fuchsia, development experience with Flutter will allow you to quickly master a new niche in the software development market.

At the same time, Flutter’s flaws cannot be ignored.

The shortcomings of using Flutter to create mobile apps

1.Entry threshold

The development language for Flutter is Dart, a language rarely used by developers, that was created by Google as an alternative to JavaScript. According to the TIOBE Index for August 2019, it is ranked 46th most popular, far behind the most popular Java, Swift, and JavaScript in mobile development. Learning a new language takes a time. In terms of syntax, Dart is close to Java, but it also has a number of differences. For example, compare 2 classes implemented in these languages.

Java

Dart

With the general similarity of syntax and logic of code building, there are differences: declaration of private variables, automatic field initialization, arrow notation (=>) for declaring a class member. Differences are even more noticeable when working with multithreading.

Of great difficulty is the fundamentally different approach of Flutter to the architecture of mobile applications. In native development, an imperative approach prevails – you create a View, add it to the parent layout and control its properties using specific methods and attributes. Instead, a declarative approach based on widgets is proposed. To build the desired UI, you need to choose a combination of widgets with specific properties. Widgets can describe the type of the component (text, image, progress bar, etc.), position on the screen, behavior, etc. In total, Flutter offers 14 categories of widgets that solve particular problems. The most commonly used of them are Animation and motion (various transitions and builders for animations), Assets, images, and icon, Async (Future and Steam builders), Basic (standard application components, for example, AppBar, Row, Column, Text), mentioned above Cupertino and Material, Styling, Text etc. With their help, you can implement most of the tasks facing the mobile application. However, to build a more or less complicated UI, you need a solid understanding of the declarative approach and the properties of various widgets. Previous experience in native Android and iOS development is more in the way than helping.

2.Limited set of tools and libraries

Flutter is a very young SDK, which appeared on the mobile development market 2 years ago. In addition to the convenience and elegance of the implementation of technical tasks, an essential feature of any framework is the availability of ready-made solutions for specific functionality. This allows you to save time on development and not to cycle every time you create a color picker or custom progress bar. The https://pub.dev/flutter/ resource provides a substantial number of packages for mobile development on Flutter. However, it is significantly inferior in the number of available solutions in native development and React Native. This means that for a more or less specific task, you have to write your own solution.

The small prevalence of the Dart language also affects. It writes the order of magnitude smaller libraries for working, for example, with phone numbers, images or streams. The chances of writing the right library yourself dramatically increase and the chances of saving development time are the other way around.

3.Larger installation file

For independence from native widgets, you also have to pay. Flutter is forced to add a Dart virtual machine to any application, which increases the size of the installation file. For the most straightforward HelloWorld application, this is 4.7 Mb. For comparison, a similar native Android application takes 540 Kb. In pursuit of saving space, Flutter is hopelessly losing to native development.

4.Weak iOS features support

Google origin of Flutter leaves its mark on the quality of support for mobile OS. If the majority of SDK features on Android work correctly, then with iOS, the situation is much sadder. For example, when photographing on Apple devices, the application deletes all EXIF data. Because of this, the photo is displayed with the wrong orientation, without location, without date, without the correct gamma. Virtually no support for iOS accessibility features has been implemented (VoiceOver, Guided Access, Captioning, and Audio Descriptions).

5.Lack of hot pushes

Cross-platform solutions React Native, Cordova and Ionic offer a mechanism for making quick changes to the application after release – hot updates or hot pushes. Although Flutter’s development roadmap for 2019 had the intention to introduce this feature, at the moment the work has been suspended. The reasons were the inability to ensure the rapid execution of updates on iOS, the potential for the introduction of malicious code, problems with package delivery. Software updates are only possible in the traditional way – by the release of new versions of Google Play or the App Store.

6.Lack of support for password managers

One of the drawbacks of using your own rather than native widgets is the occurrence of problems with the use of some features of Android and iOS. Currently, Flutter applications are experiencing problems with autocomplete input fields. This is especially noticeable if it is necessary to implement password pulling from built-in or third-party password managers. This issue is described in detail (https://github.com/flutter/flutter/issues/13015) but has not yet been resolved.

Final thoughts

Flutter is a new and very promising cross-platform SDK. It takes into account the positive experience gained by previous solutions, in particular React Native. Of course, its strengths include high performance, relative independence from native widgets, and strong support from Google and enthusiasts. At the same time, it cannot be said that it allows you to implement all the tasks of mobile development. The list of issues dedicated to unresolved issues is very solid and totals more than 7 thousand. The closest competitor to React Native is much shorter – about 600 questions. The short period of Flutter’s existence also affects. By the number of libraries and examples of problem solving, it lags behind other cross-platform solutions, not to mention the native development for Android and iOS.

What is Flutter’s current niche in the mobile development market? It can bring the greatest return as a tool for prototyping applications, if it is necessary to create a demo on both mobile platforms for display to investors. In the field of production, it is suitable for creating the simplest applications that do not have large functional requirements. If the key to the application is development speed and cheapness and you are ready to compromise on UI / UX, then this cross-platform solution is quite suitable. As experience shows, React Native now reigns in this niche market, but Flutter can compete with it quite well. If Flutter сould save its current development dynamics, solve problems with native features support and add the ability to fully develop desktop and web applications, it is possible that it will become the № 1 SDK for cross-platform development.