Interested in learning what's next for the gaming industry? Join gaming executives to discuss emerging parts of the industry this October at GamesBeat Summit Next. Register today.
Google today released Dart 2.5 and Flutter 1.9. Dart 2.5 adds stronger support for calling C code and intelligent code completion, which leverages machine learning to help developers complete their code or identify the API they should use. Flutter 1.9 lets developers build mobile, desktop, and web apps from the same codebase. The new version also supports iOS 13 and macOS Catalina, and includes new Material widgets for toggle buttons and filters.
Flutter was first announced at Google’s I/O developers conference in May 2017 and hit version 1.0 in December 2018. Meant to compete with frameworks like Facebook’s React Native, the library is designed to combine the performance and platform integrations of native mobile with the rapid development and multi-platform reach of portable UI toolkits. Flutter apps are built using Google’s Dart programming language.
The highlights of Dart 2.5‘s stable release are, ironically, two technical previews. The first is the dart:ffi foreign function interface for calling C code directly from Dart. The second is code completion powered by machine learning.
Calling C code
Support for calling C directly from Dart is currently limited to deep integration into the Dart VM using native extensions. Google’s goal is to offer a new mechanism that has “great performance, is easy to approach, and works across the many supported Dart platforms and compilers.” Dart-C interop enables two main scenarios:
- Calling into a C-based system API on the host OS.
- Calling into a C-based library, either for a single OS or cross-platform.
The dart:ffi library is launching in preview today. Try it on the Flutter master channel or a Dart dev channel. Keep in mind that there are still limitations and that Google expects breaking changes before the final release.
Intelligent code completion
As APIs grow, the list of possible completions in typed programming languages gets too long to browse alphabetically. Like Microsoft, Google is exploring using machine learning to help developers with code completions as they type.
The team used TensorFlow Lite to train a model of likely member occurrences based on a given context by analyzing a large corpus of GitHub open source Dart code. This model is then used to predict the likely next symbol as the developer is typing (GitHub repo).
The new preview is available directly as part of the Dart analyzer. This means the code completion experience is available across all Dart-enabled editors, including Android Studio, IntelliJ, and Visual Studio Code. You’ll want to use the Flutter dev channel or a Dart dev channel when previewing this feature.
Constant expressions and more
Lastly, Dart 2.5 supports many more ways to define constant expressions, including the ability to use casts and the new control flow and collection spread features shipped in Dart 2.3. While Dart has long supported creating const variables and values, constant expressions have been a bit limited until now.
As for the next Dart release, Google is working on extension methods, enforcing references to be non-nullable by default, and improved concurrency support. Due to all the recent language changes, Google is also investing in rich migration tooling for existing code.
Flutter 1.9 adds support for macOS Catalina and iOS 13, improved tooling, new Material widgets, and new Dart language features. Overall, Google notes that Flutter 1.9 is its biggest update yet, with “more than 1,500 PRs from more than 100 contributors.”
Flutter 1.9 also adds support for 24 more languages: Afrikaans, Albanian, Amharic, Assamese, Azerbaijani, Basque, Belarusian, Bengali, Burmese, Gujarati, Icelandic, Georgian, Kannada, Kyrgyz, Lao, Macedonian, Malayalam, Nepali, Oriya, Punjabi, Sinhalese, Telugu, Uzbek, and Zulu.
Flutter for web
Google released the first technical preview of Flutter for the web in May at its I/O 2019 developers conference. Now the company has merged the Flutter web repository into the main Flutter repo. This means developers can write for mobile, desktop, and web with the same codebase.
As a result, the flutter_web repository is now deprecated. If you have the latest builds of Flutter from the master or dev channel, you can target the web with the latest experimental version of Flutter by running
flutter run -d chrome.
When you create a project, Flutter now creates a web runner via a minimal web/index.html file that bootstraps your web-compiled Flutter code. That file lets you use the Flutter CLI tool or the IDE plugins to edit and run Flutter apps on the web. Google does warn, however, that support for web output with Flutter is still in an early phase.
macOS Catalina, iOS 13, and Material
Apple is releasing the latest versions of its various operating systems today, including iOS 13 and macOS Catalina. Google has made sure that Flutter works with Xcode 11, embraces the new Xcode build system and 64-bit support throughout the toolchain, and simplifies platform dependencies. Flutter 1.9 also includes an implementation of the iOS 13 draggable toolbar, with both long-press and drag-from-right, and supports vibration feedback. Work on iOS dark mode has begun, but is not done yet.
In the latest development builds, you can now turn on experimental support for Bitcode, Apple’s platform-independent intermediate representation of a compiled program. Submitting your app as Bitcode allows Apple to optimize your binary in the future without resubmission. It also means Flutter could one day support platforms like watchOS and tvOS that require Bitcode for app submission.
Apple aside, Flutter 1.9 includes several new widgets that use Google’s Material Design. The ToggleButtons widget combines icon and text widgets to form a set of buttons. The ColorFiltered widget allows you to recolor a tree of child widgets just like you can recolor an image using one of several different algorithms.
And we’ve come full circle to Dart 2.5. For iOS and Android, new projects default to Swift instead of Objective-C and Kotlin instead of Java, respectively. The team has also made Flutter’s error messages more readable, concise, and actionable.
Swift as the default language removes manual work for adding many packages to an app created with the default options. Swift 5 is ABI stable, and the Swift dynamic libraries no longer need to be included in the distribution package for iOS 12.2 or greater. That should reduce the size of Swift applications compared to previous releases.
Since Kotlin is now the default language for new projects in Android Studio, it is now also the default for both the Flutter CLI tool and the IntelliJ/Android Studio and Visual Studio Code plugins for Flutter. You can switch back to Objective-C or Java if you prefer.
GamesBeat's creed when covering the game industry is "where passion meets business." What does this mean? We want to tell you how the news matters to you -- not just as a decision-maker at a game studio, but also as a fan of games. Whether you read our articles, listen to our podcasts, or watch our videos, GamesBeat will help you learn about the industry and enjoy engaging with it. Learn more about membership.