Dart 2.14 language and Flutter 2.5 framework available

Google has published a release of the Dart 2.14 programming language, which continues the development of a radically redesigned Dart 2 branch, which differs from the original version of the Dart language by using strong static typing (types can be automatically inferred, so specifying types is not required, but dynamic typing is no longer used and was calculated initially the type is assigned to the variable and then strict type checking is applied).

Dart language features:

  • A familiar and easy-to-learn syntax that is natural for JavaScript, C, and Java programmers.
  • Providing fast startup and high performance for all modern web browsers and various types of environments, from portable devices to powerful servers.
  • The ability to define classes and interfaces to enable encapsulation and reuse existing methods and data.
  • Specifying types makes it easier to debug and detect errors, makes the code clearer and more readable, and makes it easier for third-party developers to refine and analyze it.
  • Among the supported types: various types of hashes, arrays and lists, queues, numeric and string types, date and time types, regular expressions (RegExp). It is possible to create your own types.
  • To organize parallel execution, it is proposed to use classes with the isolate attribute, the code of which is executed completely in an isolated space in a separate memory area, interacting with the main process by sending messages.
  • Support for the use of libraries that simplify the support and debugging of large web projects. Third-party implementations of functions can be included as shared libraries. Applications can be broken down into parts and the development of each part can be assigned to a separate team of programmers.
  • A set of ready-made tools to support development in the Dart language, including the implementation of dynamic development tools and debugging with code correction on the fly ("edit-and-continue").
  • An SDK, a pub package manager, a dart_analyzer static code analyzer, a set of libraries, a DartPad IDE, and Dart-enabled plugins for IntelliJ IDEA, WebStorm, Emacs, Sublime Text 2, and Vim are provided to simplify Dart development.
  • Additional packages with libraries and utilities are distributed through the pub repository, which has more than 20 packages.

Key changes in the release of Dart 2.14:

  • A new triple shift operator (>>>) has been added, which, unlike the ">>" operator, performs not an arithmetic, but a logical shift that does not take into account the sign bit (the shift is performed without dividing into positive and negative numbers).
  • Removed the restriction on type arguments that prevented generic function types from being used as a type argument. For example, now you can specify: late List (T)>idFunctions; var callback = [ (T value) => value]; late S Function (T)>(S) f;
  • It is allowed to specify arguments with types in annotations such as @Deprecated. For example, you can now specify: @TypeHelper (42, "The Meaning")
  • The static methods hash, hashAll and hashAllUnordered have been added to the standard library (core) in the Object class. Improved processing of local time in the DateTime class when converting clocks between summer and winter time that is not a multiple of one hour (for example, in Australia, an offset of 30 minutes is used). The ffi package has added support for the arena memory allocation mechanism, which automatically releases resources. Added the ability to generate Dart typedefs from C to the ffigen package.
  • The 250 most popular packages from the pub.dev repository and 94% of the top-1000 have been moved to use the Null safety mode, which will avoid crashes caused by attempts to use variables whose value is not defined and set to Null ". The mode implies that variables cannot have undefined values ​​unless they are explicitly set to null. The mode strictly takes into account the types of variables, which allows the compiler to apply additional optimizations. Type matching is checked at compile time, for example, if you try to assign the value "Null" to a variable with a type that does not imply an indeterminate state, such as "int", an error will be displayed.
  • Unified sets of rules for the code analyzer (linter) are proposed, which provide simultaneous support for checking compliance with the code style guidelines for Dart and the Flutter framework. For historical reasons, the coding rules for Flutter and Dart differed, in addition, for Dart, there were two sets of rules in everyday life - pedantic from Google and rules from the Dart developer community. Dart 2.14 introduces a new general rule set for linter, which is the default for new Dart projects and the Flutter SDK. The set includes core rules (lints/core.yaml package), recommended additional rules (lints/recommended.yaml), and Flutter-specific recommendations (flutter_lints/flutter.yaml). Users of pedantic rules are encouraged to switch to using the new coding style based on the recommendations in the Dart documentation.
  • In formatter, optimizations have been made to the formatting of cascading code blocks, which can significantly improve formatting performance and avoid ambiguous interpretation of the ownership of expression elements. For example, calling "..doIt" in the expression "var result = errorState ? foo : bad..doIt()" does not refer to the conditional part of the "bad" block, but to the entire expression, so it is now separated when formatting: var result = errorState ? foo : bad ..doIt();
  • Support for Apple M1 (Silicon) processors has been added to the SDK, which implies both the ability to run Dart VM, utilities and SDK components on systems with an Apple Silicon processor, as well as support for compiling executable files for these chips.
  • Support for a new service file ".pubignore" has been added to the "dart pub" command, which allows you to specify a list of files that will be skipped when publishing a package to the pub.dev repository. These settings do not interfere with the ".gitignore" ignore list (in some situations, pub.dev needs to not commit files that Git needs, such as internal development scripts).
  • Work has been done to improve the performance of the "dart test" command, which now does not require recompilation of tests after changing the pubspec, if the version number has not changed.
  • Removed support for compiling in ECMAScript 5 compatibility mode (change will result in loss of compatibility with IE11 browser).
  • The standalone stagehand, dartfmt and dart2native utilities have been deprecated, replaced by built-in commands called through the dart utility.
  • The VM Native Extensions mechanism has been deprecated. To call native code from Dart code, it is recommended to use the new Dart FFI (Foreign Function Interface).

At the same time, a significant release of the Flutter 2.5 user interface framework is presented, which is considered as an alternative to React Native and allows you to release applications for iOS, Android, Windows, macOS and Linux platforms based on a single codebase, as well as create applications to run in browsers. On the basis of Flutter, the user shell of the Fuchsia microkernel operating system developed by Google is built.

The bulk of the Flutter code is implemented in Dart, and the runtime engine for running applications is written in C++. When developing applications, in addition to Flutter's native Dart language, you can use the Dart Foreign Function interface to call C/C++ code. High runtime performance is achieved by compiling applications to native code for target platforms. At the same time, the program does not need to be recompiled after each change - Dart provides a hot reload mode that allows you to make changes to a running application and immediately evaluate the result.

Major changes in Flutter 2.5:

  • Significant performance optimizations have been made. Shader precompilation for the Metal graphics API has been implemented on iOS and macOS platforms. Improved efficiency of handling asynchronous events. Fixed an issue with delays when the garbage collector frees memory from unused images (for example, during the playback of a 20-second animated GIF, the number of garbage collection operations has been reduced from 400 to 4. Latency when passing messages between Dart and Objective-C / Swift has been reduced by up to 50% (iOS) or Java/Kotlin (Android) Added native build support for systems based on the Apple Silicon chip.
    Dart 2.14 language and Flutter 2.5 framework available
  • For the Android platform, support for running applications in full screen mode has been established. The implementation of the design concept "Material You", presented as a variant of the next generation of Material Design, continued. A new MaterialState.scrolledUnder state has been added, scrollbars are dynamically displayed when resized, and a new interface for displaying notification banners has been proposed.
  • The camera plug-in has been greatly expanded with controls for autofocus, exposure, flash, zoom, noise reduction, and resolution.
  • Developer tools (DevTools) have been improved with an updated widget inspection mode, as well as tools for detecting rendering delays and tracking shader compilation.
    Dart 2.14 language and Flutter 2.5 framework available
  • Improved plugins for Visual Studio Code and IntelliJ/Android Studio.

Source: opennet.ru

Add a comment