Reputation: 399
Warning: `dart` on your path resolves to /usr/lib/dart/bin/dart, which is
not inside your current Flutter SDK checkout at /home/ankit/flutter.
Consider adding /home/ankit/flutter/bin to the front of your path.
This exception started when the flutter was updated. How do I solve this?
Upvotes: 4
Views: 6586
Reputation: 126
This is happening because you have a separate installation of Dart on your system. The Flutter SDK includes and manages it's own dart SDK, but you can use the dart SDK separately.
Flutter recommends that you use the dart SDK included with Flutter because Flutter manages it - It will automatically use and upgrade supported versions when using the flutter upgrade
command on your terminal, and during initial install.
Flutter is noticing that you have a dart SDK install that did not come with the Flutter SDK. It's giving you a warning because of the possible differences in versions (and possibly other configurations) that could prevent an optimal flutter development experience.
Here's an explanation of path. You will probably need to set your path environment variables to get the whole fix.
This link shows the official Apple guide to working with the terminal environment variables (including path) but a quick google around should help you find any answers you can't find here.
The path resolves from "front" to "back" - meaning that if the executable in question occurs twice, it will grab the first one. Flutter doctor wants you to add the flutter dart path at the front so that subsequent dart calls will resolve to the Flutter Dart SDK.
Unless you're doing dart development outside flutter, you don't need an additional dart SDK. Most of the time the Flutter dart SDK will work for cases besides flutter as well.
I would recommend removing your other dart install, and using the dart install that comes with flutter. This process will vary depending on how you installed the other dart SDK.
based on what you provided, run this on your Zsh command-line:
export PATH="/home/ankit/flutter/bin:$PATH"
It will only work until you restart your computer.
Upvotes: 11