[英]Flutter Material Icons changed after upgrading SDK to 2.2.1 (latest stable)
[英]Flutter SDK path changed after running the app on Windows after MacOS
我一直在 Windows 上玩一些 flutter 基础知识然后想在 Mac 上测试它。 我成功了,但是当我再次回到 windows 再次处理它时,我发现 VSCode 在整个项目中更改了 Flutter SDK 路径。 Flutter SDK windows上的路径是
C:\Users\USERNAME\Documents\sdk\flutter
在 Mac 上
/Users/USERNAME/Downloads/flutter
当我在 Mac 之后尝试在 Windows 上再次测试它时,我遇到了很多这样的错误
Error: Error when reading '/Users/USERNAME/Downloads/flutter/packages/flutter/lib/material.dart': The system cannot find the path specified.
我跑了flutter doctor
并得到了这个
当我在项目中搜索 Mac 上 Flutter SDK 的路径时,我发现了这个
我在设置中搜索了dart.flutterSdkPath
并更改了路径,但这并没有解决这个问题
"dart.flutterSdkPath": "C:/Users/USERNAME/Documents/sdk/flutter"
所以我不得不使用搜索和替换工具将所有这些文件中的 Mac 路径替换为 Windows 的路径。 它有效,但是每次在 Windows 和 Mac 之间切换时,如何防止更改项目中的 SDK 路径?
您提到的所有这些文件都应该在 flutter 创建命令创建的.gitignore
上被忽略。 它将在您构建项目时自动生成。
如果你没有,这里是默认的.gitignore
文件
# Miscellaneous
*.class
*.log
*.pyc
*.swp
.DS_Store
.atom/
.buildlog/
.history
.svn/
# IntelliJ related
*.iml
*.ipr
*.iws
.idea/
# The .vscode folder contains launch configuration and tasks you configure in
# VS Code which you may wish to be included in version control, so this line
# is commented out by default.
#.vscode/
# Flutter/Dart/Pub related
**/doc/api/
**/ios/Flutter/.last_build_id
.dart_tool/
.flutter-plugins
.flutter-plugins-dependencies
.packages
.pub-cache/
.pub/
/build/
# Web related
lib/generated_plugin_registrant.dart
# Symbolication related
app.*.symbols
# Obfuscation related
app.*.map.json
# Android Studio will place build artifacts here
/android/app/debug
/android/app/profile
/android/app/release
更改.gitignore
文件后,确保运行git rm -r --cached.
在git add.
以确保 Git 正在跟踪正确的文件。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.