Flutter

Flutter 学习笔记

Windows Flutter SDK 安装

Download the Flutter archive from your mirror site. In your preferred browser, go to Flutter SDK archive. https://docs.flutter.cn/release/archive?tab=windows

20240726 当前最新版本: Flutter 版本: 3.22.3 Dart 版本:3.4.4 https://storage.flutter-io.cn/flutter_infra_release/releases/stable/windows/flutter_windows_3.22.3-stable.zip

将 flutter_windows_3.22.3-stable.zip sdk 解压到任意位置(根据个人喜好放置)

<path-to-flutter_windows_3.22.3-stable>\flutter

添加环境变量:

<path-to-flutter_windows_3.22.3-stable>\flutter\bin 添加到环境变量 PATH

验证安装是否成功

重新打开一个新的 Powershell 终端执行:flutter doctor 出现如下界面,说明SDK 安装成功

PS C:\Users\max_h> flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[] Flutter (Channel stable, 3.22.3, on Microsoft Windows [版本 10.0.22631.3880], locale zh-CN)
[] Windows Version (Installed version of Windows is version 10 or higher)
[] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
[] Chrome - develop for the web
[] Visual Studio - develop Windows apps (Visual Studio Community 2022 17.9.6)
[] Android Studio (version 2024.1)
[] VS Code (version 1.87.2)
[] Connected device (3 available)
[] Network resources

• No issues found!

配置国内镜像源

Tsinghua University TUNA Association maintains the mirrors.tuna.tsinghua.edu.cn mirror. It includes the Flutter SDK and pub packages.

To set your machine to use this mirror, use these commands.

On macOS, Linux, or ChromeOS:

export PUB_HOSTED_URL=https://mirrors.tuna.tsinghua.edu.cn/dart-pub;
export FLUTTER_STORAGE_BASE_URL=https://mirrors.tuna.tsinghua.edu.cn/fluttercontent_copy

On Windows:

$env:PUB_HOSTED_URL="https://mirrors.tuna.tsinghua.edu.cn/dart-pub";
$env:FLUTTER_STORAGE_BASE_URL="https://mirrors.tuna.tsinghua.edu.cn/flutter"

Using Flutter in China

https://docs.flutter.dev/community/china