简体   繁体   English

使用 Homebrew 安装后如何获取 Flutter SDK 路径

[英]How to get Flutter SDK path after installing using Homebrew

Installed flutter using homebrew: https://formulae.brew.sh/cask/flutter#default使用自制软件安装 flutter: https://formulae.brew.sh/cask/flutter#default

I can't find the SDK Path, tried copy and pasting this:我找不到 SDK 路径,尝试复制并粘贴:

1./opt/homebrew/Caskroom/flutter/2.0.5/flutter/bin/internal/shared.sh, and, /opt/homebrew/bin/flutter' 1./opt/homebrew/Caskroom/flutter/2.0.5/flutter/bin/internal/shared.sh,和,/opt/homebrew/bin/flutter'

but the result shows that the folder specified as the FLUTTER SDK home does not exist, how am I able to find the Flutter SDK path但结果显示指定为 FLUTTER SDK home 的文件夹不存在,我怎么能找到 Flutter ZF38630E3AB77 路径

Type flutter doctor -v in Terminal, the first line will show the location!在终端中flutter doctor -v ,第一行将显示位置!

在此处输入图像描述

If you install flutter using brew install --cask flutter and you are on macOS version 12.2.1 .如果您使用brew install --cask flutter flutter您使用的是 macOS 版本12.2.1 Then flutter is located in the Caskroom folder.然后flutter位于Caskroom文件夹中。

For example, usr/local/Caskroom/flutter/2.10.3/flutter例如, usr/local/Caskroom/flutter/2.10.3/flutter

In my case I installed flutter version 2.10.3 so that is the reason you use flutter SDK located inside the version folder/directory .就我而言,我安装了 flutter 版本2.10.3 ,这就是您使用 flutter SDK 位于版本folder/directory内的原因。

  1. find your homebrew futter path找到你的自制软件路径

    flutter doctor -v
  2. Copy the path under the Flutter stable channel info, eg.复制 Flutter 稳定通道信息下的路径,例如。 • Flutter version 3.0.5 at /opt/homebrew/Caskroom/flutter/3.0.5/flutter • Flutter 版本 3.0.5,位于 /opt/homebrew/Caskroom/flutter/3.0.5/flutter

  3. Open vsCode settings, search flutter path, add the path you just copied to these two places:打开vsCode设置,搜索flutter路径,将刚才复制的路径添加到这两个地方:

  • Dart: Flutter Sdk Path (inside the JSON file) Dart: Flutter Sdk 路径(在 Z0ECD11C1D7A287401D148A23BBD7 文件内)
  • Dart: Flutter Sdk Paths Dart: Flutter Sdk 路径
  1. Reload vsCode重新加载 vsCode

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM