Google’s Flutter SDK has long let developers create native applications for Android, iOS, and more. Now, Flutter’s underlying Dart programming language is gaining the ability to create native applications for Windows, Linux, and Mac, with the release of version 2.6.
Dart native executables
For the past few years, Google has been focused on making Dart as great an experience as possible for developers of Flutter applications. One of the common situations that these developers ran into — myself included — is the desire to use Dart for a backend server, even reusing code where possible.
With version 2.6 of the Dart SDK, announced today, this has become easier than ever, thanks to the new “dart2native” tool. While Dart already supported compiling your programs for better performance, dart2native takes things a step further by bundling the necessary Dart runtimes for your platform.
For example, that means on Windows, you can now easily compile your programs written in Dart to an easy-to-share ․exe file. Your program will then be able to run on any Windows computer without needing to install the Dart SDK.
The other major feature of Dart 2.6 is the preview of static extension methods, which allow you to easily create new methods for existing classes. Instead of writing a function that takes an instance of a class, you can now declare an “extension” for any particular class, which contains your additional methods.
One of the main goals of extensions is for the sake of prediction and autocomplete, allowing you to write code more like “noun.verb()” instead of “verb(noun)”. While neither style is particularly right or wrong, developer preferences have begun to shift toward putting the “noun” ahead of the “verb.”
Download Dart 2.6
Dart 2.6 is available for download now, and should also be rolling out as part of the Flutter SDK in the near future. However, Google notes that, until Dart 2.6 reaches stable Flutter, developers who wish to test out dart2native should install the Dart SDK separately from Flutter.
Be sure to check out the full changelog to learn more about what else is new in Dart 2.6, including major changes to the “foreign function interface” introduced with Dart 2.5 in September.
FTC: We use income earning auto affiliate links. More.