Flutter 正式支援 Web 平台

Flutter 的 Web 端支援在 Web 和行動裝置上提供相同的體驗。基於 Dart 的可移植性、Web 平台的強大以及 Flutter 框架的靈活性,你現在可以從同一個程式碼庫為 iOS、Android 和瀏覽器建立應用。你可以將用 Dart 編寫的現有 Flutter 程式碼編譯成 web 體驗,因為它就是完全相同的 Flutter 框架,而 Web 只是你的應用的另一個裝置目標。

Flutter architecture for web

向 Flutter 新增 Web 支援涉及在標準瀏覽器 API 之上實現 Flutter 的核心繪圖層。透過結合使用 DOM、Canvas 和 CSS,Web 支援旨在為現代瀏覽器提供便攜、高質量和高效能的使用者體驗。我們在 Dart 中完全實現了這個核心繪圖層,並使用 Dart 的最佳化過的 JavaScript 編譯器將 Flutter 核心與框架,同你的應用程式一起編譯成一個可以部署到任何 Web 伺服器的簡化源檔案。

While you can do a lot on the web, Flutter’s web support is most valuable in the following scenarios:

A Progressive Web Application built with Flutter
Flutter delivers high-quality PWAs that are integrated with a user’s environment, including installation, offline support, and tailored UX.
Single Page Application
Flutter’s web support enables complex standalone web apps that are rich with graphics and interactive content to reach end users on a wide variety of devices.
Existing mobile applications
Web support for Flutter provides a browser-based delivery model for existing Flutter mobile apps.

Not every HTML scenario is ideally suited for Flutter at this time. For example, text-rich, flow-based, static content such as blog articles benefit from the document-centric model that the web is built around, rather than the app-centric services that a UI framework like Flutter can deliver. However, you can use Flutter to embed interactive experiences into these websites.

For a glimpse into how to migrate your mobile app to web, see the following video:

關於 web 支援的說明

以下資源可以幫助你入門: