! Warning: `dart` on your path resolves to /usr/local/Cellar/dart/2.1.0/libexec/bin/dart, which is n

问题

项目执行多语言脚本报错,代码没有改动,之前都运行良好,突然有些代码就不灵了。

执行flutter doctor,发现一个警告

 ! Warning: `dart` on your path resolves to /usr/local/Cellar/dart/2.1.0/libexec/bin/dart, which is not inside your current Flutter SDK checkout at /Users/Alice/code/flutter. Consider adding
      /Users/Alice/code/flutter/bin to the front of your path.

解决方案

Warning: dart on your path resolves to /usr/local/Cellar/dart/2.13.3/libexec/bin/dart, which is not inside your current Flutter SDK checkout at
/Users/wangyang/Developer/develop_env/flutter_3.7.9. Consider adding /Users/wangyang/Developer/develop_env/flutter_3.7.9/bin to the front of your
path.

看警告提示是检查到了单独的Dart SDK,不是在Flutter SDK之中,建议我们将Flutter中的Dart路径添加到环境变量中。
说白了就是系统中存在了2个Dart SDK,我们只需要将单独的Dart SDk删除就好。

根据路径Cellar,我们判断出这是以前使用homebrew安装的Dart。
我们使用brew list查看是否安装过.

发现确实安装过, 我们使用brew remove dart来卸载Dart.

可以看到卸载的路径正好对应了警告中的路径,说明确实是这个Dart引发的警告。

再次运行flutter doctor -v, 警告消失,搞定!

你可能感兴趣的:(Flutter问题集锦,android,flutter)