简体   繁体   中英

update dart sdk for flutter

I would like to use dart SDK >= 2.2.0 with flutter. But my current version used BY Flutter is 2.1.2

flutter --version
Flutter 1.2.1 • channel stable • https://github.com/flutter/flutter.git
Framework • revision 8661d8aecd (2 months ago) • 2019-02-14 19:19:53 -0800
Engine • revision 3757390fa4
Tools • Dart 2.1.2 (build 2.1.2-dev.0.0 0a7dcf17eb)

I tried to install the 2.2.0 version independently and I succeed:

dart --version
Dart VM version: 2.2.0 (Tue Feb 26 15:04:32 2019 +0100) on "macos_x64"

However, Flutter doesn't use this version as you can see above. I tried to replace files of the dart-sdk used by flutter ( flutter/bin/cache/dart-sdk ) by the version that I installed independently, but when I try to run Flutter after that I have a snapshot problem so I have put back the original dart-sdk folder in the flutter directory.

Do you have any ideas how can I update it?

PS: I downloaded flutter very recently (10 days ago) from here: https://flutter.dev/docs/get-started/install/macos

I would like to use dart SDK >= 2.2.0 with flutter. But my current version used BY Flutter is 2.1.2

flutter --version
Flutter 1.2.1 • channel stable • https://github.com/flutter/flutter.git
Framework • revision 8661d8aecd (2 months ago) • 2019-02-14 19:19:53 -0800
Engine • revision 3757390fa4
Tools • Dart 2.1.2 (build 2.1.2-dev.0.0 0a7dcf17eb)

I tried to install the 2.2.0 version independently and I succeed :

dart --version
Dart VM version: 2.2.0 (Tue Feb 26 15:04:32 2019 +0100) on "macos_x64"

However, Flutter doesn't use this version as you can see above. I tried to replace files of the dart-sdk used by flutter ( flutter/bin/cache/dart-sdk ) by the version that I installed independently, but when I try to run Flutter after that I have a snapshot problem so I have put back the original dart-sdk folder in the flutter directory.

Do you have any ideas how can I update it?

PS: I downloaded flutter very recently (10 days ago) from here: https://flutter.dev/docs/get-started/install/macos

I would like to use dart SDK >= 2.2.0 with flutter. But my current version used BY Flutter is 2.1.2

flutter --version
Flutter 1.2.1 • channel stable • https://github.com/flutter/flutter.git
Framework • revision 8661d8aecd (2 months ago) • 2019-02-14 19:19:53 -0800
Engine • revision 3757390fa4
Tools • Dart 2.1.2 (build 2.1.2-dev.0.0 0a7dcf17eb)

I tried to install the 2.2.0 version independently and I succeed :

dart --version
Dart VM version: 2.2.0 (Tue Feb 26 15:04:32 2019 +0100) on "macos_x64"

However, Flutter doesn't use this version as you can see above. I tried to replace files of the dart-sdk used by flutter ( flutter/bin/cache/dart-sdk ) by the version that I installed independently, but when I try to run Flutter after that I have a snapshot problem so I have put back the original dart-sdk folder in the flutter directory.

Do you have any ideas how can I update it?

PS: I downloaded flutter very recently (10 days ago) from here: https://flutter.dev/docs/get-started/install/macos

I would like to use dart SDK >= 2.2.0 with flutter. But my current version used BY Flutter is 2.1.2

flutter --version
Flutter 1.2.1 • channel stable • https://github.com/flutter/flutter.git
Framework • revision 8661d8aecd (2 months ago) • 2019-02-14 19:19:53 -0800
Engine • revision 3757390fa4
Tools • Dart 2.1.2 (build 2.1.2-dev.0.0 0a7dcf17eb)

I tried to install the 2.2.0 version independently and I succeed :

dart --version
Dart VM version: 2.2.0 (Tue Feb 26 15:04:32 2019 +0100) on "macos_x64"

However, Flutter doesn't use this version as you can see above. I tried to replace files of the dart-sdk used by flutter ( flutter/bin/cache/dart-sdk ) by the version that I installed independently, but when I try to run Flutter after that I have a snapshot problem so I have put back the original dart-sdk folder in the flutter directory.

Do you have any ideas how can I update it?

PS: I downloaded flutter very recently (10 days ago) from here: https://flutter.dev/docs/get-started/install/macos

You might need to Update your pubspec.yaml depending on the flutter channel you want to work on:

If you are on stable channel:

Go into pubspec.yaml and type in:

environment:
  sdk: ">=2.2.0 <3.0.0"

( Whatever Dart SDK version you want comes in the front)

dependencies:
  cupertino_icons: ^1.0.0

If you are on beta channel:

environment:
      sdk: ">=2.12.0 <3.0.0"

dependencies:
  cupertino_icons: ^1.0.1

Then if you are on stable channel (or beta), open the terminal in your IDE and enter

flutter channel stable
# or flutter channel beta
flutter upgrade
flutter pub get

Check the version with flutter --version

Hope it helps.

I would like to use dart SDK >= 2.2.0 with flutter. But my current version used BY Flutter is 2.1.2

flutter --version
Flutter 1.2.1 • channel stable • https://github.com/flutter/flutter.git
Framework • revision 8661d8aecd (2 months ago) • 2019-02-14 19:19:53 -0800
Engine • revision 3757390fa4
Tools • Dart 2.1.2 (build 2.1.2-dev.0.0 0a7dcf17eb)

I tried to install the 2.2.0 version independently and I succeed :

dart --version
Dart VM version: 2.2.0 (Tue Feb 26 15:04:32 2019 +0100) on "macos_x64"

However, Flutter doesn't use this version as you can see above. I tried to replace files of the dart-sdk used by flutter ( flutter/bin/cache/dart-sdk ) by the version that I installed independently, but when I try to run Flutter after that I have a snapshot problem so I have put back the original dart-sdk folder in the flutter directory.

Do you have any ideas how can I update it?

PS: I downloaded flutter very recently (10 days ago) from here: https://flutter.dev/docs/get-started/install/macos

I would like to use dart SDK >= 2.2.0 with flutter. But my current version used BY Flutter is 2.1.2

flutter --version
Flutter 1.2.1 • channel stable • https://github.com/flutter/flutter.git
Framework • revision 8661d8aecd (2 months ago) • 2019-02-14 19:19:53 -0800
Engine • revision 3757390fa4
Tools • Dart 2.1.2 (build 2.1.2-dev.0.0 0a7dcf17eb)

I tried to install the 2.2.0 version independently and I succeed :

dart --version
Dart VM version: 2.2.0 (Tue Feb 26 15:04:32 2019 +0100) on "macos_x64"

However, Flutter doesn't use this version as you can see above. I tried to replace files of the dart-sdk used by flutter ( flutter/bin/cache/dart-sdk ) by the version that I installed independently, but when I try to run Flutter after that I have a snapshot problem so I have put back the original dart-sdk folder in the flutter directory.

Do you have any ideas how can I update it?

PS: I downloaded flutter very recently (10 days ago) from here: https://flutter.dev/docs/get-started/install/macos

Yeah, the cause of the problem is inherent in the fact that Flutter does not use the dart present on your Local machine the Flutter sdk instead comes with the latest compatible dart sdk shipped along with it.

When you run the command flutter version it prints the current flutter version and the current dart-sdk version shipped along with it. If you wish to use a later version of the dart sdk you'll have to upgrade your flutter sdk and if the specific dart-sdk version you want is not yet available for any branch in the stable channel I will suggest you switch to the master or dev channel and hopefully the latest release of those channels will support the required sdk constraint you need. But beware other branches aside the stable branch are not totally safe as you can encounter strange and unresolved errors so have that at the back of your mind.

The dark SDK that you updated is probably the one on your global dart installation.

Check your flutter dart path with the command

which flutter dart

If it is looking like this

[/path-to-flutter-sdk]/bin/flutter
/usr/local/bin/dart

you need to change it to use the one associated to flutter:

[/path-to-flutter-sdk]/bin/flutter
[/path-to-flutter-sdk]/bin/dart

To update it, you need to update your $PATH so [/path-to-flutter-sdk]/bin/flutter comes before /usr/local/bin .


it is so simple if dart was installed with flutter just do the below line:

flutter upgrade

I would like to use dart SDK >= 2.2.0 with flutter. But my current version used BY Flutter is 2.1.2

flutter --version
Flutter 1.2.1 • channel stable • https://github.com/flutter/flutter.git
Framework • revision 8661d8aecd (2 months ago) • 2019-02-14 19:19:53 -0800
Engine • revision 3757390fa4
Tools • Dart 2.1.2 (build 2.1.2-dev.0.0 0a7dcf17eb)

I tried to install the 2.2.0 version independently and I succeed :

dart --version
Dart VM version: 2.2.0 (Tue Feb 26 15:04:32 2019 +0100) on "macos_x64"

However, Flutter doesn't use this version as you can see above. I tried to replace files of the dart-sdk used by flutter ( flutter/bin/cache/dart-sdk ) by the version that I installed independently, but when I try to run Flutter after that I have a snapshot problem so I have put back the original dart-sdk folder in the flutter directory.

Do you have any ideas how can I update it?

PS: I downloaded flutter very recently (10 days ago) from here: https://flutter.dev/docs/get-started/install/macos

Open terminal commands to Upgrade Flutter – Dart SDK
1-> C:\flutter 
2->run command  " flutter channel master "
3->run command after switching " flutter upgrade "

在此处输入图片说明 Now open android studio which automatically fetch updated sdk from flutter folder

You can upgrade dart SDK using terminal by typing flutter upgrade . This will upgrade both flutter and dart SDK. Actually flutter upgrade includes the Flutter and Dart SDK and doesn't install them separately.

If you struggle to make any of these solutions work, you might have different versions of flutter on your system.

I checked my version on the command line and upgraded via 'flutter upgrade' to the latest stable release, which did not solve the problem in IntelliJ / Android Studio, as that pointed to another local version of flutter.

To check, run 'which flutter' on the command line and check with the version displayed in "Preferences --> Languages & Frameworks --> Flutter" and make sure they point at the same flutter installation.

如果你使用android studio,Tools->Flutter->Flutter upgrade 点击flutter upgrade就可以安装了

Try this

flutter channel stable
flutter upgrade

or this

flutter channel master
flutter upgrade

我在 macOS 上使用flutter upgrade channel stable ,它工作正常

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM