ARN

Google pulls the wraps off Flutter, Dart upgrades

Flutter 2 native UI toolkit debuts production-quality support for the web, while Dart 2.12 adds sound null safety

Google's Flutter UI toolkit and companion Dart language have both received upgrades this month, with Flutter 2 moving web support from beta to stable and Dart 2.12 adding null safety.

An open source UI toolkit for building natively compiled apps for multiple operating systems and form factors, Flutter now includes the web among the supported platforms. Google said three scenarios are critical to Flutter web support:

  • Progressive web apps (PWA), combining the web with desktop app capabilities.
  • Single-page apps.
  • Making existing Flutter mobile apps work with the web.

Also part of the web support is the Canvaskit-powered rendering engine built with WebAssembly. Other capabilities added in recent months include text autofill, control over address bar URLs, and routing, and PWA manifests. For desktop browsers, support has been added for interactive scroll bars and keyboard shortcuts.

Unveiled March 3, Flutter 2 also moves desktop support to stable under an early release flag. The update includes improvements related to text editing and mouse input, and adds a built-in context menu to TextField and TextForm widgets for the Material and Cupertino design languages.

With Flutter, a single codebase can be used to build apps for mobile, desktop, and web, using the Dart programming language. Optimised for client development, Dart compiles to native machine code for mobile and desktop and to JavaScript for the web. Native platforms supported by Flutter include iOS, Android, Windows, MacOS, and Linux.

Flutter installation instructions can be found at flutter.dev. Other improvements in Flutter 2 include a plug-in is available for Google Mobile Ads SDK for Flutter, providing for inline banner and native ads. This capability is now in beta.

This includes state restoration for iOS, for building an IPA directly from the command line without needing the Xcode toolset, as well as widgets for AutocompleteCore, for putting autocomplete functionality into an app, and ScaffoldMessenger, for SnackBar-related issues.

Delving deeper, static memory costs of creating additional Flutter engines have been reduced. Flutter Fix, which combines a Dart command line tool with changes suggested by the Dart analyzer to clean up deprecated APIs in a codebase.

DevTools, for debugging, is now called Flutter DevTools and has been made production quality. Improvements have been made to the Flutter extension for Visual Studio Code and the Flutter plug-in for JetBrains IntelliJ IDEs. The Visual Studio Code extension brings testing enhancements while the IntelliJ plug-in offers a new project wizard. The DartPad tool for the Dart language has been updated to support Flutter 2.

Flutter 2 contains Dart 2.12, which also was announced on March 3. Improvements in Dart 2.12 include stable sound null safety and Dart:FFI (foreign function interface). Null safety helps developers avoid null errors, a class of bugs that can be hard to spot, and strengthens the type system.

FFI is an interoperability mechanism to invoke existing code written in C, such as calling Windows Win32 APIs. Developers get the Dart SDK at dart.dev.