1.按照官方文档的安装dart语言
Install using a Linux package manager
#
You have two options to install the Dart SDK on Ubuntu or Debian:
- Use the apt-get command.
- Download a .deb package and run the
dpkg
command.
Install using the apt-get
package manager
#
To install Dart with apt-get
, perform the following steps. You need steps 1 to 3 only for the first install.
-
Update the package index files and install the secure HTTP package.
content_copy$ sudo apt-get update && sudo apt-get install apt-transport-https
-
Download and add the Google Linux GPG public key.
content_copy$ wget -qO- https://dl-ssl.google.com/linux/linux_signing_key.pub \| sudo gpg --dearmor -o /usr/share/keyrings/dart.gpg
-
Add the Dart package repository to your Linux system.
content_copy$ echo 'deb [signed-by=/usr/share/keyrings/dart.gpg arch=amd64] https://storage.googleapis.com/download.dartlang.org/linux/debian stable main' \| sudo tee /etc/apt/sources.list.d/dart_stable.list
-
Use the following
sudo apt-get
commands.$ sudo apt-get update && sudo apt-get install dart
dart --version 可以看到dart安装的版本 dart sdk 存储路径在/user/lib/dart
二、下载 https://dart.dev/get-dart flutter sdk 解压下 比如放在这个目录下/home/denghg/Flutter/flutter
三、添加flutter 到linux的环境变量下 这里有个坑flutter的环境变量得在系统PATH的前面
export FLUTTER_PATH=/home/denghg/Flutter/flutter/bin
export PATH=$FLUTTER_PATH:$PATH:$JAVA_HOME:$ANDROID_NDK:$ANDROID_SDK:$ANDROID_HOME:$CMAKE_PATH:$DEPOT_TOOL:$NODE_PATH:$GOROOT:$GOPATH:$NGINX:$GOPROXY:$FFMPEG_PATH:$SVG_PATH:$SHELL_PATH
flutter sdk 跟dartsdk是两个不同的东西 dart 是一份语言sdk flutter是一个框架调用dart语言所以两个都要。
四、 android studio plugin 安装Flutter插件 然后配置Flutter sdk位置
然后运行flutter doctor验证环境配置 根据提示的问题修改
比如缺少android command-line tools
新建flutter项目参考这篇文章
Android studio配置Flutter(看这一篇就够了)_android studio flutter-CSDN博客