软硬件要求:Start building Flutter native desktop apps on Linux

----------------------------------------------------------------

关联参考:

Flutter:Foreign Function Interfaces (FFI)  https://blog.csdn.net/ken2232/article/details/142550595 

Flutter 桌面支持   https://blog.csdn.net/ken2232/article/details/142549135 

软硬件要求:Start building Flutter native desktop apps on Linux  https://blog.csdn.net/ken2232/article/details/142550677     

=====================================

Start building Flutter native desktop apps on Linux 

https://docs.flutter.dev/get-started/install/linux/desktop

Get started > Install > Linux > Make Linux desktop apps

Verify system requirements

To install and run Flutter, your Linux environment must meet the following hardware and software requirements.

Hardware requirements

Your Linux Flutter development environment must meet the following minimal hardware requirements.

RequirementMinimumRecommended
CPU Cores48
Memory in GB816
Display resolution in pixelsWXGA (1366 x 768)FHD (1920 x 1080)
Free disk space in GB4.052.0

Software requirements

To write and compile Flutter code for desktop, you must have the following version of Linux and the listed software packages.

Tip

You do not need to install Dart separately as the Flutter SDK includes the full Dart SDK.

Operating system

Flutter supports Debian Linux 11 or later and Ubuntu Linux 20.04 LTS or later .

Development tools

OS 需要安装必要的依赖。

To develop Flutter on Linux:

  1. Verify that you have the following tools installed: bash, file, mkdir, rm, which

    which bash file mkdir rm which
    /bin/bash
    /usr/bin/file
    /bin/mkdir
    /bin/rm
    which: shell built-in command
  • Install the following packages: curl, git, unzip, xz-utils, zip, libglu1-mesa

    sudo apt-get update -y && sudo apt-get upgrade -y;
    sudo apt-get install -y curl git unzip xz-utils zip libglu1-mesa
  • To develop Linux apps, use the following command to install these packages:
    clang, cmake, ninja-build, pkg-config, libgtk-3-dev, libstdc++-12-dev

    sudo apt-get install \
          clang cmake git \
          ninja-build pkg-config \
          libgtk-3-dev liblzma-dev \
          libstdc++-12-dev

When you run the current version of flutter doctor, it might list a different version of one of these packages. If it does, install the version it recommends.

The developers of the preceding software provide support for those products. To troubleshoot installation issues, consult that product's documentation.

Configure a text editor or IDE

You can build apps with Flutter using any text editor or integrated development environment (IDE) combined with Flutter's command-line tools.

Using an IDE with a Flutter extension or plugin provides code completion, syntax highlighting, widget editing assists, debugging, and other features.

Popular options include:

Recommended

The Flutter team recommends installing Visual Studio Code 1.77 or later and the Flutter extension for VS Code. This combination simplifies installing the Flutter SDK.

Install the Flutter SDK

To install the Flutter SDK, you can use the VS Code Flutter extension or download and install the Flutter bundle yourself.

Use VS Code to install Flutter

To install Flutter using these instructions, verify that you have installed Visual Studio Code 1.77 or later and the Flutter extension for VS Code.

Prompt VS Code to install Flutter
  1. Launch VS Code.

  2. To open the Command Palette, press Control + Shift + P.

  3. In the Command Palette, type flutter.

  4. Select Flutter: New Project.

  5. VS Code prompts you to locate the Flutter SDK on your computer.

    1. If you have the Flutter SDK installed, click Locate SDK.

    2. If you do not have the Flutter SDK installed, click Download SDK.

      This option sends you the Flutter install page if you have not installed Git as directed in the development tools prerequisites.

  6. When prompted Which Flutter template?, ignore it. Press Esc. You can create a test project after checking your development setup.

Download the Flutter SDK
  1. When the Select Folder for Flutter SDK dialog displays, choose where you want to install Flutter.

    VS Code places you in your user profile to start. Choose a different location.

    Consider ~/development/

  2. Click Clone Flutter.

    While downloading Flutter, VS Code displays this pop-up notification:

    Downloading the Flutter SDK. This may take a few minutes.
  • This download takes a few minutes. If you suspect that the download has hung, click Cancel then start the installation again.

  • Once it finishes downloading Flutter, the Output panel displays.

    Checking Dart SDK version...
    Downloading Dart SDK from the Flutter engine ...
    Expanding downloaded archive...

When successful, VS Code displays this pop-up notification:

Initializing the Flutter SDK. This may take a few minutes.

While initializing, the Output panel displays the following:

Building flutter tool...
Running pub upgrade...
Resolving dependencies...
Got dependencies.
Downloading Material fonts...
Downloading Gradle Wrapper...
Downloading package sky_engine...
Downloading flutter_patched_sdk tools...
Downloading flutter_patched_sdk_product tools...
Downloading windows-x64 tools...
Downloading windows-x64/font-subset tools...

This process also runs flutter doctor -v. At this point in the procedure, ignore this output. Flutter Doctor might show errors that don't apply to this quick start.

When the Flutter install succeeds, VS Code displays this pop-up notification:

Do you want to add the Flutter SDK to PATH so it's accessible
in external terminals?
  1. VS Code may display a Google Analytics notice.

    If you agree, click OK.

  2. To enable flutter in all a shell windows:

    1. Close, then reopen all a shell windows.
    2. Restart VS Code.

Check your development setup

help Help

Run Flutter doctor

The flutter doctor command validates that all components of a complete Flutter development environment for Linux.

  1. Open a shell.

  2. To verify your installation of all the components, run the following command.

    flutter doctor

As you chose to develop for desktop, you do not need all components. If you followed this guide, the result of your command should resemble:

Running flutter doctor...
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.24.3, on Ubuntu 20.04 (LTS), locale en)
[!] Android toolchain - develop for Android devices
[!] Chrome - develop for the web
[!] Android Studio (not installed)
[✓] Linux toolchain - develop for Linux desktop
[✓] VS Code (version 1.93)
[✓] Connected device (1 available)
[✓] Network resources


! Doctor found issues in 3 categories.

Troubleshoot Flutter doctor issues

When the flutter doctor command returns an error, it could be for Flutter, VS Code, one of the Linux libraries, the connected device, or network resources.

If the flutter doctor command returns an error for any of these components, run it again with the verbose flag.

flutter doctor -v

Check the output for other software you might need to install or further tasks to perform.

If you change the configuration of your Flutter SDK or its related components, run flutter doctor again to verify the installation.

Start developing Linux desktop apps with Flutter

Congratulations. Having installed all prerequisites and the Flutter SDK, you can start developing Flutter apps for Linux desktop.

To continue on your learning journey, consult the following guides:

Manage your Flutter SDK

To learn more about managing your Flutter SDK install, consult the following resources.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值