The Future Is Flutter... |
Written by Mike James |
Thursday, 06 December 2018 |
Is Google's Flutter just another attempt to rescue a failed language - Dart - or is it the future of mobile development? It really is too early to say, but with the release of Flutter 1.0 the balance seems to be moving to the future view. Dart is an unremarkable language - think another C-type, block-structured language with objects; or think JavaScript with all the innovative bits taken away. Just because it is boring doesn't mean it isn't a useful language as non-boring isn't a requirement of a good language. It failed, however because, it wasn't supported in the browser by anyone other than Google and it quickly became apparent that no other browser maker had any intention of supporting something invented by Google as a replacement for JavaScript.
So Dart sort of drifted off into a backwater until someone had a brilliant idea - Flutter. Dart - Flutter - you see the connection? Take the Dart language and add a runtime environment or "app engine" in Flutter speak, and you have something that can run outside of a browser. Make the runtime environment available for Android and iOS and you have a way to create apps that aren't native but are closer to native than web apps. From here you can extend the runtime to work in the browser or on the desktop and you have a complete cross-platform solution in one language and one framework. Some are calling this new, but of course it is anything but new. Any virtual machine, as in Java VM, is an app engine. So was Silverlight, and any browser add-in that let you run another language. Xamarin does the same job for Android, iOS and others. More recently PhoneGap or Cordova works in exactly the same way only with Cordova you the "app engine" is a browser component that runs HTML/JavaScript within a native app. In fact, Flutter is closest to Cordova than anything else; only it is a native app with a custom app engine not a browser component. So I suppose the real question is why move to Flutter when you could choose Cordova or Xamarin? Good question and hard to answer. The Dart language doesn't really have anything to offer over C#, say, and while you might consider it a better JavaScript, you could use TypeScript and Cordova. The official line is that Flutter is fast. It claims to compile to native 32-bit and 64-bit ARM code - no mention of x86. It also makes a point of saying that it uses the Skia 2D graphics engine, which is used by Chrome and Android - but not iOS, which they don't point out. Animation at 60fps is claimed and 120fps perhaps in the future. The real problem is how do you do the UI? Flutter comes with its own UI framework, which is much like any other UI framework. It has lots of "view" objects which you build into hierarchies using a container. A quick look at the available objects will remind you of almost any other UI framework. Indeed, it looks a lot like the early Android framework with a row and column linear layout, a stack and grid. What is missing is the infamously complex - sorry I meant to say sophisticated - Constraint layout that is being forced on Android programmers. The big shock is that the layout is all done in code. You write Dart statements to build your UI. There isn't an XML or XAML equivalent and there certainly isn't a drag-and-drop designer. This might be fine, but in my tests the edit-compile-run loop was far to slow to make it possible to design a sophisticated UI quickly. You may not like drag-and-drop editors but if Flutter is to attract beginners it needs one. You can use it via a plug-in for Android Studio, Intellij or Visual Studio Code. I tried it out under Android Studio and found the installation instructions to be less than clear. Perhaps one day Android Studio will come with a built-in Flutter option, but for now set aside some time to install it. When you do have it installed be prepared to wait for the first compilation. It is slow, even compared to Android. Recompilation is faster, but still not really fast enough. This is a significant problem. At this point you might think that the verdict is in and Flutter is more a dead leaf than a butterfly, but no... It is true that at the moment I wouldn't give up Android native in Kotlin for Flutter, even though it has problems. I also wouldn't give up using Cordova for cross-platform, even though this too has problems - but I will still be keeping an eye on Flutter. Why? The first reason is that Google seems to be using it internally and this means Flutter has more of a future than you might think. Google's Fuchsia operating system also runs Flutter apps natively - whatever that means. Android is a huge, overdeveloped mess and after ten years Google might well have its eye on a replacement. Perhaps getting a lot of Flutter apps out there would make Fuchsia adoption easier.
Yes, if Google does manage a second hit OS with Fuchsia, Flutter will be in there somewhere - but this is a long way down the road, and years not months. In the meantime it is worth noting that Flutter Desktop is in the early stages for Windows, MacOS and Linux. There are even instructions to get it running on a Raspberry Pi. It might be that with sufficient support this might be an interesting way to create apps.
More InformationFlutter 1.0: Google’s Portable UI Toolkit Related ArticlesAll A Flutter - Google's Cross Platform App Framework Ready To Go Google's Dart Reborn As Cross Platform App Language Dart Changes Course - No Longer To Be Native In Chrome Dart 1.8 Adds Support for App Engine and enums Angular Partners With TypeScript To be informed about new articles on I Programmer, sign up for our weekly newsletter, subscribe to the RSS feed and follow us on Twitter, Facebook or Linkedin.
Comments
or email your comment to: comments@i-programmer.info <ASIN:1871962544> <ASIN:1871962552> |
Last Updated ( Wednesday, 13 November 2019 ) |