Google has introduced the Flutter 2 framework for building user interfaces, marking the transformation of the project from a mobile app development framework to a universal framework for creating any type of software, including desktop applications and web apps.
Flutter is seen as an alternative to React Native and allows developers to create applications for various platforms—including iOS, Android, Windows, macOS, and Linux—based on a single codebase, as well as applications that run in browsers. Apps previously written in Flutter 1 can be adapted to work on desktop and web without needing to rewrite code when upgrading to Flutter 2.
The core of Flutter's code is implemented in Dart, while the runtime engine for executing applications is written in C++. In addition to Dart, the native language for Flutter, developers can utilize the Dart Foreign Function interface to call code written in C/C++. High performance is achieved through compiling applications to machine code for the target platforms. Importantly, programs do not need to be recompiled after each change as Dart provides a hot reload mode, allowing changes to be made in a running application and evaluated immediately.
Flutter 2 boasts full support for building web applications suitable for production deployments. It highlights three main scenarios for using Flutter on the web: developing standalone web applications (PWA, Progressive Web Apps), creating single-page web applications (SPA, Single Page Apps), and converting mobile applications into web applications. Key development features for web include leveraging 2D and 3D rendering acceleration mechanisms, flexible element layouts on the screen, and a rendering engine compiled to WebAssembly called CanvasKit.
Support for desktop applications is currently in beta testing and will be stabilized later this year in one of the upcoming releases. Companies like Canonical, Microsoft, and Toyota have announced support for development using Flutter. Canonical has chosen Flutter as the primary framework for its applications and is using it to develop a new installer for Ubuntu. Microsoft has adapted Flutter for foldable devices with multiple screens, such as the Surface Duo. Toyota plans to use Flutter for in-car infotainment systems. The custom shell of Google's developing microkernel operating system Fuchsia is also built on Flutter.

Simultaneously, the release of the Dart 2.12 programming language was announced, continuing the evolution of the radically redesigned Dart 2 branch. Dart 2 differs from the original version of the Dart language by implementing strong static typing (types can be inferred automatically, so type annotations are not mandatory, but dynamic typing is no longer used, and the initially inferred type is bound to the variable and is tightly checked thereafter).
The release is notable for stabilizing the null safety feature, which aims to prevent crashes caused by attempting to use variables with undefined values set to null. This mode implies that variables cannot have undefined values unless they are explicitly assigned a null value. The types of variables are strictly enforced, allowing the compiler to apply additional optimizations. Type conformity is checked at compile time; for instance, if an attempt is made to assign a null value to a variable of a type that does not allow for an undefined state, such as int, an error will be generated.
Another significant improvement in Dart 2.12 was the stable implementation of the FFI library, enabling the creation of high-performance code capable of accessing APIs in C. Performance and size optimizations have been made. Developer tools and a profiling system for code written using Flutter have been added, as well as new plugins for developing applications in Dart and Flutter for Android Studio/IntelliJ and VS Code.

Source: opennet.ru
