为桌面构建 Flutter 应用程序

Build flutter app for desktops

我看到一些人成功地为其他 OS 构建了 flutter 应用程序,而不是通常的 Android/IOS

我的问题很简单:如何?为 mac/windows 构建 flutter 应用程序的当前流程是什么?它不需要生产就绪。一些实验性的东西就足够了

对于那些想知道如何: https://github.com/google/flutter-desktop-embedding

有一个使用 openGL 渲染 flutter 应用程序的示例

这是我发现有用的东西,它目前处于 alpha 版本,但通过使我们能够在 Flutter 中开发 Mac 和 Windows 应用程序来完成这项工作: https://feather-apps.com/

你可以看看这个link

https://github.com/google/flutter-desktop-embedding

仍然不稳定,但在桌面上渲染 flutter 应用程序方面做得很好

运行 Desktop 中的 Flutter 项目

第 1 步: 要让 Flutter 在桌面上达到 运行,我们必须使用最新版本的主频道。所以 运行 从 cmd,

flutter channel master

flutter upgrade

第 2 步: 然后我们必须启用 flutter 桌面支持。

set ENABLE_FLUTTER_DESKTOP=true

第 3 步: 然后克隆 this repocd 示例目录。

第 4 步: 然后用我们现有的代码替换示例目录中的 lib 文件夹,并用我们现有的代码替换 pubspec.yaml 文件。

第 5 步: 然后 运行 从终端

flutter packages get

flutter run

您可以找到更多信息 here

对于那些想知道当前状态(2021)的人,这里是 startup project to help you test It for MacOS, Linux, Windows. The project heavily modified from official ci to build cross-platform easily. You might want to check the ci.yml 如果你想在某个平台上构建而不需要 github-action。

此外,go-flutter is also a valid option, that used go-langopenGL实现跨平台功能。

如果想知道两者的区别official and go-flutter, here is the issue详情