Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ


Choose your language

InfoQ Homepage News Dart 2 Revamped for Mobile Development

Dart 2 Revamped for Mobile Development

The latest version of Google’s Dart programming language, sporting a strengthened type system, cleaned-up syntax, and an improved toolchain, is being touted by Google as the way to go for Mobile and Web app development, enabling a 2–3x productivity increase.

Dart 2 makes its strongly-typed mode mandatory to ensure bugs are caught earlier in the development process. Type annotations remains optional, though, and types are inferred when not declared. You can preview the readiness of your Dart 1.x code for Dart 2 by enabling Dart 1.x strong mode.

A relatively minor change to the language that has a big impact on Dart syntax readability is the ability to omit new and const when calling a constructor. This makes it possible to declare UI using a more declarative syntax. For example you can now write:

Widget build(BuildContext context) =>
    height: 56.0,
    padding: EdgeInsets.symmetric(horizontal: 8.0),
    decoration: BoxDecoration(color:[500]),
    child: Row(

instead of the following Dart 1.x-compatible version:

Widget build(BuildContext context) {
  return new Container(
    height: 56.0,
    padding: const EdgeInsets.symmetric(horizontal: 8.0),
    decoration: new BoxDecoration(color:[500]),
    child: new Row(

Dart supports mobile app development through Google’s Flutter framework, which aims to make it possible to create native UIs for Android and iOS. Flutter is able to natively compile to ARM and x86 processors. When coupled with Flutter’s engine, which provides an efficient garbage collector, this makes it possible to create mobile apps that run entirely natively.

The shift in Dart’s positioning for client-side development is confirmed by Google product manager for Dart Anders Thorhauge Sandholm:

The focus for us in evolving the Dart language and libraries is on maximizing the value and utility for client-side development.

This does not mean, though, that Dart usage for command-line or server-side code is being deprecated. Dart’s new focus on client-side development may be seen as an attempt by Google to increase Dart’s adoption across the industry outside of Google, which remains its biggest adopter. According to Sandholm, the performance and predictability of Dart, along with its sound type system, allowed Google AdWords engineers to be two- to three-times more productive than before. Additionally, Sandholm says, Google teams using Dart on AdWords Express and AppTree have been able to share between 50% and 70% of code across mobile and web.

Rate this Article