Introduction
On May 9 this year, Dart Team
announced the Dart 2.3 SDK
stable release of the new language features can improve the coding experience in the development of user interfaces for the development of Flutter UI
new 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.3
Operator 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 null
extended operator ...?
to avoid anomalies:
var list;
var list2 = [0, ...?list];
assert(list2.length == 1);
复制代码
collection if 和 collection for
Dart 2.3
Also introduced collection if
and collection for
can use it to use conditions if
and loops for
to build a collection.
When the following example promoActive
is true
added to only the element set:
var nav = [
'Home',
'Furniture',
'Plants',
if (promoActive) 'Outlet'
];
复制代码
Use the following collection for
to 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.3
the UI
theme consistent, but also to IDE
support the addition of a new UI
guide functions. UI
The guide is UI
drawn horizontal and vertical lines in the code, making it easier to see the Flutter UI build()
tree structure method.
UI
Guide IntelliJ IDEA
and Android Studio
the Flutter
plug-ins 35.2
provide version. To enable this feature, select Preferences > Languages & Frameworks > Flutter > UI Guides
. VS Code
It 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 API
full 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 Code
the v2.26 provides a plug-in, IntelliJ 2019.1
and the upcoming Android Studio 3.5
version 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 Team
All content is also a lot of remodeling and adding a new page to the previous lack of core content.
Dart Team
Also update the Pub
package website: You have to move it to a new one URL
: pub.dev .