Dev Watch

Blog archive

With Flutter, Google Throws Dart at Cross-Platform Mobile Development

Google has taken the wraps off Flutter, a new open source mobile development framework that uses the Dart programming language to create high-performance apps that can run on iOS and Android with one code base.

While still a work in progress yet to reach 1.0 status -- no Windows support, practically no documentation, no IDE (an Atom plug-in is in the works), no deployment tools and so on -- the new Flutter.io Web site was today unleashed on the Hacker News and Reddit social coding sites. The Flutter site says: "We are focused on low-latency input and high frame rates on Android and iOS," seeking to provide users with "beautiful, fast and jitter-free app experiences."

The Flutter site explains how the project came to being at Google:

Back in 2014, some engineers in Google took a step back to ask, "What would a modern mobile-first rendering engine look like?" Without worrying about backward compatibility, or desktop concerns, or legacy constraints, they started coding a new engine named Sky. Encouraged by some of their initial performance measurements, they decided to make the experiment a real project and renamed it Flutter. In 2015, internal teams inside of Google started to take notice and began building apps on Flutter, and the flutter.io site was born.

Not the React Way
Although its optional functional-reactive-style framework was inspired by the Facebook React project, Flutter uses the "write once, run anywhere" model, as opposed to the React Native "learn once, write anywhere" paradigm. The latter uses the same technology approach to target completely separate native apps, rather than using one project code base to build an app for multiple OSes. Facebook engineers have decried "write once, run anywhere" as an impossible pipe dream.

Google begs to differ.

"Learning Flutter will allow you to quickly create high-performance mobile applications for both iOS and Android; leveraging a single code base investment to ship on multiple platforms," the site FAQ says. "It uses a modern, typed programming language that is instantly familiar to anyone who has done Java or JavaScript programming. Flutter gives developers quick edit cycles for an enjoyable low-friction workflow."

Flutter System Architecture
[Click on image for larger view.] Flutter System Architecture (source: Flutter.io)

Bashing Dart
That modern, typed programming language is Dart, Google's own creation, a "scalable programming language, with robust libraries and runtimes, for building Web, server and mobile apps" that the company also open sourced.

The choice of Dart as the default programming language came under some fire (as does everything) on Hacker News and Reddit.

"Honestly, between the use of a relatively exotic language of dubious quality with types that are 'optional and unsound,' their custom widget implementation that who knows how well is going to work, and lack of Web support, it doesn't seem very attractive," read the very first comment on Hacker News. "React Native seems a much safer bet."

Meanwhile, on the Reddit programming thread one poster said: "I know a few people were originally expecting Dart to replace Java a bit, particularly after Swift came out, but then it just stopped happening and seemed to die -- honestly, at this point I'm surprised it's still being used."

Defending Dart
As if expecting the backlash, Google proactively defended its choice of Dart on the Flutter FAQ: "Dart gives us a scalable language and a feature set that supports simple scripts all the way up to full-featured apps. We wanted something that would be instantly familiar to JavaScript, Java and C# developers. Dart's robust core libraries meant that we didn’t need to write a lot of core library code." After providing more reasoning, the FAQ item concluded: "In short, we adopted Dart because it was the best language that we could find that we wanted to code in every day."

Another notable feature of Flutter is the aforementioned custom widget implementation. With its emphasis on high frame rates and a jitter-free UX, Flutter includes "a heavily optimized, mobile-first 2D rendering engine" and its own optional Material Design widgets. "Flutter is unique technically because its rendering implementation uses neither WebView nor OEM widgets," the site says. "Instead, Flutter uses its own high-performance rendering engine to draw widgets."

The main draw, though, would be if Flutter can actually produce cross-platform apps that attain performance and functionality equal to pure native apps, something that Facebook engineers have said is impossible. True cross-platform functionality would provide enormous benefits to enterprise mobile developers.

"We noticed that too many teams were slowed down by building the same app twice: once for Android and once for iOS," the Flutter site says. "Hiring two separate teams is costly: knowledge isn't shared, code is duplicated, keeping two apps in sync is challenging. We are building Flutter to make it easier and faster for teams to deliver great mobile apps for both iOS and Android."

Unlike some other cross-platform tooling, Flutter doesn't target the Web and has no plans to do so. It also doesn't plan to target desktop apps, though it encourages the open source community to put it to new uses (in other words: "we're not doing that, but you can").

What's Next
What it does plan to do -- in addition to providing Windows support, documentation and so on -- is deliver tools to easily create .ipa files for iOS and .apk files for Android. "Although it is possible to build a standalone APK containing your application, doing so right now is difficult," the site says. "If you're feeling brave, you can see how we build the Stocks.apk in examples/stocks. Eventually we plan to make this much easier and support platforms other than Android, but that work is still in progress."

In the meantime, Flutter comes with the optional React-inspired framework and its own Material Design widgets. Unlike React, Google says the Flutter framework is designed to be layered, so developers can use only the parts they want -- or an entirely different framework.

Google encouraged developers to get involved with the project, which is hosted on GitHub (18 contributors, 301 commits, one branch, 0 releases), to get it ready for creating production apps.

"As of November 2015, Flutter is still being developed heavily and is not yet at 1.0," the site says. "While lower levels of the system are changing less, we envision changing parts of the system based on early adopter feedback."

That feedback can be fed back to Google via an issue tracker and a mailing list.

Posted by David Ramel on November 6, 2015