Welcome to Our Website

Flutter 3.10 and Dart 3 , What’s New?

Flutter 3.10 dart 3

Flutter 3.10 fleshes out the Material 3 widget toolkit and support for macOS and iOS targets, while Dart 3 introduces sound null safety, major new language features, and a Wasm preview

Other article on Flutter here

Google has released Dart 3, a significant update to their programming language, and the associated Flutter 3.10 UI toolkit for building mobile, web, and desktop applications. The update includes design and macOS/iOS enhancements, new language features, and 100% sound null safety. In addition, Dart 3 includes a preview for WebAssembly (Wasm) compilation.

On May 10, Google announced updates to both Dart and Flutter. Installation instructions can be found on the Dart and Flutter documentation websites. Dart 3 has three major improvements:

  • Sound null safety, which prevents runtime errors from nulls, reduces compiled output size, and improves performance. 99% of the 1,000 packages on the dev package manager for Dart currently support null safety.
  • New language features that support structured data with records, destructuring, and pattern matching, as well as abstract data types for modern programming.
  • Class modifiers, a “power user” feature that allows package owners to better express the capabilities of APIs.

Dart’s builders have also been working on compiling Dart to the Wasm binary format to bring faster loading and improved performance to web applications. Dart to Wasm compilation is now being previewed, and developers need a browser that supports WasmGC to use it.

Flutter 3.10 includes improved support for the Material 3 widget toolkit, including algorithmic color scheme generation, as well as several enhancements for building macOS and iOS apps. This includes spell-checking support in the editable text widget, a new checkbox widget, and wireless debugging support. The Impeller renderer, which promises less jank and more consistent performance, is now the default renderer on iOS.

Flutter 3.10 also includes a JNI bridge to Jetpack libraries written in Kotlin, which allows calling a new Jetpack library directly from Dart without requiring an external plugin.

Google’s main goal for Flutter is to provide five core characteristics: beauty, speed, productivity, portability, and universal availability, making it free and open source.

New Patterns in Dart 3

Destructuring

When an object and pattern match, the pattern can then access the object’s data and extract it in parts. In other words, the pattern destructures the object:

var numList = [1, 2, 3];
// List pattern [a, b, c] destructures the three elements from numList...
var [a, b, c] = numList;
// ...and assigns them to new variables.
print(a + b + c);

Variable declaration

You can use a pattern variable declaration anywhere Dart allows local variable declaration. The pattern matches against the value on the right of the declaration. Once matched, it destructures the value and binds it to new local variables:

// Declares new variables a, b, and c.
var (a, [b, c]) = ('str', [1, 2]);

A pattern variable declaration must start with either var or final, followed by a pattern.

Variable assignment

variable assignment pattern falls on the left side of an assignment. First, it destructures the matched object. Then it assigns the values to existing variables, instead of binding new ones.

Use a variable assignment pattern to swap the values of two variables without declaring a third temporary one:

var (a, b) = ('left', 'right');
(b, a) = (a, b); // Swap.
print('$a $b'); // Prints "right left".