Flutter: Your New Friend for Mobile App Development

The situation for mobile development has been painful. The two major platforms don’t support any common conventional programming language. Mind you, this is an improvement from several years ago when it seemed there were four platforms, again with no common language. BlackBerry OS 10 and Windows Mobile have since fallen off the bottom. Even so, to get the best results you have to build your application twice, once for Android and again for iOS. Common sense says that that is once too many! Fortunately, Google’s Flutter package lets you make good-looking mobile apps from a single codebase!

Naturally, clever programmers have devised “cross platform” solutions to this problem. The two main approaches are to try to make a web site look like a mobile application, and to make a programming environment that lets you generate an application for two (or more) platforms from one code base. Note: to package apps for the iOS market you pretty much have to develop on a Mac, or use a “build farm” that will do this for you.

In the web site area, one of the best known is Cordova / PhoneGap. Don’t let its two different names bother you – Adobe bought the company (Nitobi) and renamed their version, but left the open-source version with the well-known Apache Software Foundation. Cordova lets you use any HTML and JavaScript you like to build your application.

Another of the best-known web-based entries is Facebook’s React Native, which provides its own set of components. Both Cordova and ReactNative have some capabilities for accessing the underlying platform for tasks that go beyond what you can code in JavaScript. My concern with this type of toolkit has always been the difficulty of completely emulating the native environment, with complexities like back button behavior, different menu conventions, and so on. These issues may seem trivial, but they matter to users used to systems behaving in certain ways.

In the compiled language area, there are many frameworks as well. One well-known example is Xamarin, which was built by a small company (Ximian) and acquired by Microsoft. This uses the compiled C# programming language to write core application logic. It supports Windows and Mac development IDEs (on Windows it uses Visual Studio).

Google have recently shaken up this area by releasing Flutter, a new cross-platform SDK that supports Android, iOS and the web. Flutter uses Dart as its programming language and the native toolkits for Android and iOS. Dart compiles to those platforms and can also compile directly to JavaScript. The language has been around for several years and didn’t get much respect at first, but now it is getting traction. Dart is object-oriented and will be familiar to users of most modern programming languages. It’s dual-mode in that it runs in an interpreted mode while debugging. This gives it the fastest instant-reload of any such framework!. Yet it compiles down to machine code for deployment so it can run fast. Very fast. Flutter can compute video frames at some awesome frame-rate without any “flutter”. Dart also has a library or module mechanism – with many packages available –  for accessing native code such as the camera, mobile preferences, etc; the user of these packages doesn’t have to know or care how they work.

Unlike many other frameworks, Flutter doesn’t need two different languages to build an app. Android, for example, requires the use of both Java (or Kotlin) and XML. Java/Kotlin are used for the executable code, and XML for many descriptive functions such as the layout of visual components. Flutter uses Dart for everything. This means that there isn’t a graphical UI builder (yet; some steps have been taken towards one). The UI language (“widget set”) is simple enough that any practicing developer should find it easy to build powerful layouts easily.

Android developers who’ve just learned the Kotlin language may not be excited by yet another language.. Kotlin is another modern language, from a different team at Google. Maybe both “alternate” languages were prompted by Oracle’s massive lawsuit over Google’s use of Java in Android. One expects Google to move away from Java as a result of this suit. The lawyers proved that Java is only “open” as far as Oracle wants it to be, and no further.  That aside, Dart is similar enough to Kotlin that it will be recognizable to Kotlin devs, with a few traps. There are several good comparisons online; start here.

There will probably never be one single toolkit that everybody agrees to use for mobile development. But I think Flutter is going to become one of the dominant frameworks for mobile and app development. I encourage mobile developers to look at it, and try writing a real application or two with Flutter.

Type to search blog.learningtree.com

Do you mean "" ?

Sorry, no results were found for your query.

Please check your spelling and try your search again.