Skip to content
DeveloperMemos

Google I/O 2023: What's New in Dart 3

Google I/O, Dart, Dart 3, Sound Null Safety, Language Features2 min read

Google I/O 2023 brought exciting news for developers as Google announces the release of Dart 3, the most significant Dart release to date.

Dart 3 introduces three major advancements, making it a highly anticipated release for the developer community:

  1. 100% Sound Null Safety: Dart 3 achieves the milestone of 100% sound null safety, making it the first programming language to add this feature to an existing language. This ensures a sound type system where values marked as non-null will never be null, eliminating null pointer exceptions and enabling optimized code.

  2. Major Language Features: Dart 3 introduces new language features such as records, patterns, and class modifiers. These additions enhance the language's expressiveness and enable developers to work with structured data more efficiently.

    • Records: Developers can now build structured data using records, which offer a concise syntax and can be used for function return values, variables, lists, maps, and more.

    • Patterns: The introduction of pattern matching simplifies working with structured data. Developers can destructure records, lists, and maps using patterns, making code more readable and concise. Patterns can also be used in switch statements, providing enhanced power and expressiveness.

    • Class Modifiers: Class modifiers allow developers to define fine-grained access controls for classes. This feature is particularly useful for building large API surfaces and enterprise-class apps, ensuring specific capabilities and maintaining simplicity.

  3. Preview of the Future: Compilation to WebAssembly (Wasm): Google provides a glimpse of the future by previewing Dart's support for native code on the web through Wasm compilation. This development aims to improve web app load times, performance, and semantic consistency, bringing Dart web closer to native platforms.

With these advancements, Dart 3 aligns with Google's vision of creating the most productive programming language for building fast applications on any platform.

Migration and Resources

  • Dart 3's achievement of 100% sound null safety benefits from the strong support of the Dart community, with 99% of the top 1000 packages on pub.dev already supporting null safety.
  • Most packages and apps that have migrated to null safety should seamlessly work with Dart 3. However, some minor adjustments may be required due to legacy core library API removals and tool modifications.
  • Developers can refer to the Dart 3 migration guide for a smooth transition.
  • Additional documentation and codelabs are available for detailed explanations of records, patterns, and class modifiers.

Looking Ahead

  • Dart 3 marks a significant step forward, and Google plans to refine and improve the newly introduced features based on developer feedback.
  • Incremental features like inline classes and primary constructors are being explored to enhance developer productivity without migration costs.
  • Google is also actively working on expanding native interop capabilities, such as Java, Kotlin, Objective C, and Swift interop, to further support mobile and desktop app development.
  • The preview of Dart to Wasm compilation showcases the potential of using native code on the web and aligning web semantics with other native platforms.

Dart 3 represents a major milestone in the evolution of Dart, offering enhanced features, improved null safety, and a promising future. Developers can start leveraging these advancements in the stand-alone Dart SDK and the Flutter 3.10 SDK.