This article is more than 1 year old

Google fiddles with cross-platform Flutter and Dart to boost performance, tooling

Devs also urged to ditch 'pedantic' lint rules

Google on Wednesday updated Flutter and Dart, the Chocolate Factory's cross-platform app framework and its associated programming language, bringing performance and tooling improvements to devs.

Neither of the two releases, Flutter 2.5 and Dart 2.14.1, bring major changes like stable support for desktop Flutter apps – which is still in beta. Rather they address under-the-hood issues like the reduction of interface jank – small rendering delays that make animations and interactions slow and uneven.

For example, Flutter 2.5 adds support for the precompilation of shaders for Apple's Metal 3D graphics API, which improves graphics performance on iOS and macOS by allowing the shaders to load more quickly.

"We continue to make progress on reducing iOS jank and this is another step along that path," explained Chris Sells, Google product manager for Flutter, in a blog post.

Other sources of jank were addressed too. The processing of graphics frames has been given priority over processing other asynchronous events so animations don't get interrupted by network or filesystem activity. And Flutter's too-polite hints to the Dart VM to reclaim memory via garbage collection were made harder to ignore, which helps avoid low-memory situations on resource-constrained devices.

The Flutter team also improved latency for communication between Dart and Objective-C/Swift (iOS) and between Dart and Java/Kotlin (Android) by as much as 50 per cent.

Flutter 2.5 allows apps built on Apple Silicon M1 Macs to run natively on ARM iOS simulators, without Apple's Rosetta layer translating between x86 and ARM64 instruction sets. This is mainly of interest to developers who may use the iOS simulator when coding their Flutter apps – it will perform better on Apple Silicon hardware. Desktop builds of Flutter apps on macOS don't yet have ARM64 support.

Compatibility with various Android full-screen modes has been improved as has support for Google's Material You design specification. The camera plugin has also been renovated.

Beyond that, the new Flutter release improves DevTools performance, enhances the Widget Inspector, and generally spiffs up interactions with code editors like Microsoft Visual Studio Code, Java code IntelliJ, and Android Studio.

Dart not quite 180

Dart 2.14.1 has added support for Apple Silicon M1 hardware to its stable channel. When these changes get fully integrated into Flutter, then Flutter desktop app builds will run native ARM64 code on macOS with Apple M1 hardware, as mobile builds do already on iOS devices.

The latest language release also revises the lint rules available to developers – linters are static code analysis tools that are commonly used for checking code formatting and styling. The new rules are intended to replace the "pedantic" lint rules that evolved from Google's internal Dart style guide that Flutter never used.

There's also now support for a .pubignore file, which lets devs list files that they don’t want to upload when publishing a package to the public pub.dev repository, and smarter package testing, so small changes don't invalidate build tests.

Version 2.14.1 of the Dart has a few additional programming language features, like the triple shift operator (>>>).

"This is similar to the existing shift operator (>>), but where >> performs an arithmetic shift, >>> performs a logical, or unsigned, shift where zero-bits are shifted into the most significant bit regardless of whether the number being shifted is positive or negative," explains Michael Thomsen, senior product manager at Google, in a blog post.

Also, a restriction on type arguments, which prevented generic function types as a type argument, has been removed, and various core Dart packages and libraries have been modified with additional methods and other code improvements.

Finally, there are several breaking changes. These include: #46545: Removal of support for ECMAScript5, which means no more support for older browsers like Internet Explorer 11; #46100: Deprecation of stagehand, dartfmt, and dart2native, due to the merger of these three separate command-line interface (CLI) tools into a single Dart CLI; and ​​#45451: Deprecation of VM Native Extensions,which have been replaced by the Dart FFI (foreign function interface).

Flutter continues to make inroads among developers. As of May, according to Google, there were over 200,000 Flutter apps in Google Play. The framework is used by companies like eBay Motors, WeChat, and ByteDance. In Stack Overflow's 2021 Developer Survey, 13.55 per cent of developers asked about the frameworks they use and want to use cited Flutter, compared to 14.15 per cent who mentioned React, the most popular UI framework listed. And Dart was listed as the 7th most beloved programming language by respondents. ®

More about

TIP US OFF

Send us news


Other stories you might like