Dart 2.17 has been officially released .
Important New Features
- Enumeration already supports member variables
- Improve parameter forwarding to superclasses
- More flexibility for named parameters
- Provides new templates in the Flutter plugin, improved platform integration by using
dart:ffi
(native interop with C) - Experimental support for RISC-V processors
- Signing support for macOS and Windows executables
Enumerations that support member variables
Dart 2.17 now supports member variables of enum types. This means that developers can add fields that hold state, constructors that set state, methods with functionality, and even overload existing methods.
superclass initializer
For type inheritance relationships, a common treatment is to pass some constructor parameters to the superclass's constructor. For this, the subclass needs to
- List each parameter in its constructor
- Use these parameters to call the constructor of the superclass, which leads developers to write a lot of repetitive code, reduces code readability, and is not easy to maintain
Dart 2.17 addresses this problem by introducing a new construct to indicate that a parameter is specified in the superclass. Officials say that when this feature was applied to the Flutter framework, a total of nearly 2,000 lines of code were reduced .
Add a template to the Flutter plugindart:ffi
In Flutter, FFI is the mainstream way to build plugins that use the host platform's native API (eg Windows win32 API). In Dart 2.17 and Flutter 3, FFI templates were officially flutter
added to the tool, and developers can now easily create FFI plugins with dart:ffi
Dart APIs supported by calling native code. Details
See the release announcement for more .