News

Full Dart 2 Support Highlights Google's Flutter Mobile SDK Update

Google this week announced the third beta of Flutter, its mobile SDK for building iOS and Android apps using the company's own Dart programming language.

Seeking a new approach to mobile app development, Google earlier this year rebooted its Dart programming language in the preview of Dart 2, focusing on new features for client-side development.

In describing that Dart 2 reboot, Google detailed optimizations such as the strengthening of its type system, adding by default the type-safe functionality formerly implemented by opting in for "strong mode," described as "a sound static type system that uses a combination of static and runtime checks to ensure your code is type safe."

"This helps Dart developers catch bugs earlier in the development process, better scale to apps built by large teams, and increase overall code quality," Google said in a Feb. 22 post.

Basically, stronger typing lets developers catch errors at compile time rather than at run time, as it will flag, for example, the assignment of a String variable to an int type, something that's fine in loosely typed languages such as JavaScript.

In the new Flutter Beta 3, Google said Dart 2 is now fully enabled in the SDK, with a more terse syntax lending itself to creating Flutter UIs.

[Click on image for larger, animated GIF.] Flutter in Animated Action, Showing Hot Reload (source: Google)

In the Flutter approach, those UIs are built from a single codebase, compiled directly to native ARM code, leverage GPUs, and can access native platform APIs and services.

According to Google, this is a much-needed, new way forward for mobile development.

"We believe mobile development needs an upgrade," the company said this week. "All too often, developers are forced to compromise between quality and productivity: either building the same application twice on both iOS and Android, or settling for a cross-platform solution that makes it hard to deliver the native experience that customers demand. This is why we built Flutter: to offer a new path for mobile development, focused foremost on native performance, advanced visuals, and dramatically improving developer velocity and productivity."

Helping with that new approach in Beta 3 are:

Localization support including right-to-left languages

Improved support for building highly-accessible applications

New tooling including a widget inspector that helps developers see the visual tree for a UI and preview how widgets will look during development

Emerging support for integrating ads through Firebase

Full support for Visual Studio Code as a first-class development tool via a dedicated Flutter extension

The announcement that Flutter is a first-class toolkit for Material Design, with the Material and Flutter teams teaming up to deliver even more support for Material Design

All these enhancements and many more are explored in detail in a Medium post by Tim Sneath.

He said the new release focused on three primary areas: fundamentals, ecosystem and tooling.

Sneath also followed up with more details about that Dart 2 revamp.

"In this release, Dart 2 adds some syntactic sugar to help with instantiating widgets in Flutter," he said. "The new keyword is now entirely optional: there should be no need to use it any longer, and it's a bug if the compiler complains."

Furthermore, he said: The const keyword becomes optional for any child constructors within an existing const scope. During the first two betas, we identified scenarios where it was difficult to infer from the context whether an object's children are immutable, so we require the const keyword at the top level to make the constant nature of the code explicit. Once you've declared a section as const, however, the children are automatically const without requiring further declaration."

Going forward to the 1.0 release, Google said the focus is on specific areas such as:

Performance and size. Google will work on improving both the speed and consistency of Flutter's performance, and offer additional tools and documentation for diagnosing potential issues. It will also reduce the minimum size of a Flutter application.

Compatibility. The company says it will increase support for a broad range of device types, including older 32-bit devices and expanding the set of out-of-the-box iOS widgets. It also promises work to make it easier to add Flutter to existing Android or iOS codebase.

Ecosystem. In partnership with the broader community, Google said it will continue to build out an ecosystem of packages that make it easy to integrate with the broad set of platform APIs and SDKs.

"Like every software project, the trade-offs are between time, quality and features," Google said. "We are targeting a 1.0 release within the next year, but we will continue to adjust the schedule as necessary. As we're an open source project, our open issues are public and work scheduled for upcoming milestones can be viewed on our GitHub repo at any time."