Dart 2 Announced

Today, Google's Dart team has announced the next version of its Dart language, Dart 2, that is optimized for client and mobile apps.

Today, Dart team has announced a new version of Dart language as Dart 2. This new version has been optimized for client-side development for web and mobile. With this new version, dart has rebuilt the developer toolchain from the ground up making mobile development enjoyable and productive. Dart 2 also consists of instructions from early adopters including Flutter, AdWords, and AdSense, with many more small and big improvements.
 
Source: Dart  
 
The company mentions the following benefits of the language –
  • Productive. The syntax must be clear and concise, tooling simple, and dev cycles near-instant and on-device.
  • Fast. Runtime performance and startup must be great and predictable even on small mobile devices.
  • Portable. Client developers have to think about three platforms today: iOS, Android, and Web. The language needs to work well on all of them.
  • Approachable. The language can’t stray too far from the familiar if it wishes to be relevant for millions of developers.
  • Reactive. A reactive style of programming should be supported by the language.
The company has also added some new features to the language –
 
Strong, Sound Typing
 
The groups behind AdWords and AdSense have built some of Google’s biggest and maximum superior web apps with Dart bringing a huge proportion of Google’s revenue.
 
The company explains the working of Dart 2 with the example as –
 
void main() {
List<int> prices = ['99', '27', '10000', '20000000'];
// Sort in place from smallest to largest
prices.sort();
print('Lowest price is ${prices[0]}!');
}
UI as Code
 
The company has reduced the need for context switching between separate UI markup language and the programming language. Dart 2 has introduced “New” and “Const”.
 
This feature is also explained by an example as –
 
// Before Dart 2
Widget build(BuildContext context) {
return new Container(
height: 56.0,
padding: const EdgeInsets.symmetric(horizontal: 8.0),
decoration: new BoxDecoration(color: Colors.blue[500]),
child: new Row(
...
),
);
}
// After Dart 2
Widget build(BuildContext context) =>
Container(
height: 56.0,
padding: EdgeInsets.symmetric(horizontal: 8.0),
decoration: BoxDecoration(color: Colors.blue[500]),
child: Row(
...
),
);
 
On the announcement of the Dart 2 the company states –
 
"With the improvements announced today, Dart 2 is a productive, clean, battle-tested language that addresses the challenges of modern app development. It’s already loved by some of the most demanding developers on the planet, and we hope you’ll love it too."

To know more about Dart 2, you can visit the official announcement here


Next Recommended Reading Dart 2.5 Arrives With ML Code Completion