4, Dart: 2.3 release;

Introduction

  On May 9 this year, Dart Teamannounced the Dart 2.3 SDKstable release of the new language features can improve the coding experience in the development of user interfaces for the development of Flutter UInew tools to support, as well as two new sites: dart.dev and pub.dev .

New features for building user interfaces

  In Dart 2.3, there are three functions for expression based on the new list, a UI conditionally or repeatedly.

Extended operator...

  Dart 2.3Operator introduces extended ...and extended operator nulls sensing ...?, which provides a simple method of inserting a set of a plurality of elements.

  For example, operators can use the extended ...all the elements of the list into another list:

var list = [1, 2, 3];
var list2 = [0, ...list];
assert(list2.length == 4);
复制代码

  If the expression to the right extended operator may be null, it can be supported by using the nullextended operator ...?to avoid anomalies:

var list;
var list2 = [0, ...?list];
assert(list2.length == 1);
复制代码

collection if 和 collection for

  Dart 2.3Also introduced collection ifand collection forcan use it to use conditions ifand loops forto build a collection.

  When the following example promoActiveis trueadded to only the element set:

var nav = [
  'Home',
  'Furniture',
  'Plants',
  if (promoActive) 'Outlet'
];
复制代码

  Use the following collection forto create a collection:

var listOfInts = [1, 2, 3];
var listOfStrings = [
  '#0',
  for (var i in listOfInts) '#$i'
];
assert(listOfStrings[1] == '#1');
复制代码

IDE and editor of new features

UI Guide

  For with Dart 2.3the UItheme consistent, but also to IDEsupport the addition of a new UIguide functions. UIThe guide is UIdrawn horizontal and vertical lines in the code, making it easier to see the Flutter UI build()tree structure method.

  UIGuide IntelliJ IDEAand Android Studiothe Flutterplug-ins 35.2provide version. To enable this feature, select Preferences > Languages & Frameworks > Flutter > UI Guides. VS CodeIt does not support this feature.

No import library API code completion

  You can call on any prefix code completion, and will see the current package for all APIfull path: it is directly dependent on the package as well SDK. If you choose to complete your code has not been imported from the library, the tool will automatically add the import statements.

  This new automatic import feature in VS Codethe v2.26 provides a plug-in, IntelliJ 2019.1and the upcoming Android Studio 3.5version will provide this functionality.

The new Dart & Pub Website

  dart.dev provides a new landing page, focused on the interpretation of Dart platform's core strengths. And also updated the documentation page for better navigation and more visually appealing. Dart TeamAll content is also a lot of remodeling and adding a new page to the previous lack of core content.

  Dart TeamAlso update the Pubpackage website: You have to move it to a new one URL: pub.dev .

Guess you like

Origin blog.csdn.net/weixin_34315665/article/details/91395690