update dart sdk for flutter
This issue is because of the dart version and by updating flutter the dart version won't update, the way for solving this is, first, you need to be on the dev or master channel,
flutter channel master
flutter upgrade
after that run flutter doctor -v
as you see your dart is still an old one
in this step, you should update it manually, as the doc says Dart
for Windows user
choco upgrade dart-sdk
for Mac users if you user brew to install dart
brew upgrade dart
and if you don't, you can install it
brew tap dart-lang/dart
brew install dart
wish this solves your issue.
You have to upgrade flutter from cli with flutter upgrade
command. Then flutter will use latest version of Dart SDK. Flutter does not use your local Dart Sdk.
It might be due to the fact you are on channel stable
which is the most secure builds of the four channels to get updated (channels are listed here)
If you are a bit more curious to try out the new features without having to risk bad builds I advocate channel beta
:
Every month, we pick the "best" dev build of the previous month or so, and promote it to beta. These builds have been tested with our codelabs.
where the stable channel has this description:
When we believe we have a particularly good build, we promote it to the stable channel. We intend to do this more or less every quarter, but this may vary. We recommend that you use this channel for all production app releases. We may ship hotfixes to the stable channel for high-priority bugs, although our intent is to do this rarely.
You can change the channel to point at beta
by running this command in your terminal:
flutter channel beta
followed by flutter upgrade
to ensure you have got the last release for this particular branch.
Let me know how this affect your situation.