Null values will not be permitted in areas where they aren’t expected to appear when the third major Dart programming language update will be released in mid-2023.
“Our next release Dart 3, completes the journey towards a full sound, null-safe language,” Michael Thomsen (product manager for Dart and Flutter) stated in a blog post. “As the final step in that journey, we are removing many historical Dart language and SDK artifacts. This includes support for running without proper nuclear safety.”
Thomsen explained that not all implementations of null safety are so secure. TypeScript is an example. You can assign a null variable a null value. C# also has exceptions to its null checking. Kotlin has its exceptions.
However, there is a price. Sound null security will be the only choice, so pubspec files – Dart package metadata – with an SDK constraint for less than 2.12 won’t resolve in Dart. Thomsen says that sound null safety is supported by about 85 percent of Flutter code written in Dart. All remaining 15% of apps and packages written in Dart are encouraged to modify their code before Dart 3 arrives.
German automaker BMW revised the null safety code for its MyBMW app. It was built using Dart framework Flutter. Christian Schmid, BMW AG’s head of mobile app development, stated that while the null-safety migration was challenging for a large-scale codebase such as the MyBMW App, Google’s tools were invaluable. We are happy to have a more error-prone codebase now that the migration is complete.
The next major milestone in Dart 3 will likely be the support for compiling Dart codes into WebAssembly (Wasm). This will allow Flutter Web applications to run natively in browsers after the release of Dart 3. This effort will require cooperation from the W3C and browser vendors to add support for garbage-collected languages (like Dart) to Wasm via the WasmGC extension.