To fix, just give the Dart extension an explicit reference to your SDK installation(s) using the extension settings ([Ctrl + ,], type ‘Dart:’) or by directly editing settings.json
([Ctrl + Shift + P], type ‘settings.json’, [Enter]).
If you have both Flutter and the full Dart SDK installed, add both listings:
1 2 3 4 5 |
<span class="hljs-string">"dart.sdkPaths"</span>: [ <span class="hljs-string">"C:\\Program Files (x86)\\Dart\\dart-sdk\\bin"</span>, <span class="hljs-string">"C:\\Program Files (x86)\\Flutter\\bin\\cache\\dart-sdk\\bin"</span>, ], |
If you have only one installed (most commonly just Flutter), you can just add that one:
1 2 |
<span class="hljs-string">"dart.sdkPath"</span>: <span class="hljs-string">"C:\\Program Files (x86)\\Flutter\\bin\\cache\\dart-sdk\\bin"</span>, |