Mac desktop application developed using the Flutter

Flutter can develop Mac, Linux, Windows desktop, but for the platform can only play for the package, and this package debugging platform.

Switch to the master branch

First, you must switch to the master branch. I had the dev branch, toss for a long time, only stay in the theoretical concept stage. Until there is a book that Jane saw the need in the master branch, tested it can really run properly. In fact it was mainly the card can not be found in this part of the desktop simulator locally.

Turn on the Mac desktop application development

Flutter the master is off by default for desktop applications, we can use the following command to enable:

flutter config --enable-macos-desktop

flutter config --enable-linux-desktop

flutter config --enable-windows-desktop

The default configuration file will modify the flutter, the configuration directory is: .flutter_settings under the user name of the current directory.

Flutter check your phone's desktop simulator

Use the command:

flutter devices

Creating Flutter works with Mac desktop applications

Oh package name is lower case, otherwise it does not match the package name of the dart.

flutter create --macos hello_desktop_demo

After successfully created:

So that the project supports the Mac desktop application

Mac support is relatively good, after you create a project up and running instantly. Relatively speaking, you need to install Windows VS. Linux also requires corresponding components.

Publishing platform package

Because different building their own platforms, packaging commands are different, there is only Mac application as an example.

Compile the installation package corresponding to the platform:

flutter build macos

flutter build linux

flutter build windows

Construction of success

Mac application package corresponding to the output

Directly run Mac applications

You can compile the corresponding version, build in the project directory / correspondence under the platform / release directory. Here the same platform can only be compiled and the unit.

  • Linux platform to compile an executable file
  • Windows platform to compile the .exe file
  • Mac platform compile the file as .pgk

summary

To build desktop applications is not particularly stable, if you encounter problems, you can check the official documentation here only as an introduction.

Guess you like

Origin www.cnblogs.com/gdky005/p/shi-yong-flutter-kai-fa-mac-zhuo-mian-ying-yong.html