Upgrade your Flutter version

640?wx_fmt=jpeg

No matter which Flutter release channel you use, you can use  flutter commands to update the packages that the Flutter SDK and app depend on.

1. One-time setup

In order for the  flutter command to work correctly, the pubspec.yaml files under your project  must require the Flutter SDK.

For example, the following code section defines  flutter and  flutter_test packages dependent Flutter SDK:

name: hello_world
dependencies:
  flutter:
    sdk: flutter
dev_dependencies:
  flutter_test:
    sdk: flutter

 caution
Do not use the  pub get  or  pub upgrade  command to manage the dependencies of Flutter apps, but use  flutter pub get  or  flutter pub upgrade . If you want to use pub manually, you can FLUTTER_ROOT  run it directly by setting  environment variables.

2. Upgrade Flutter SDK and packages

In order to upgrade the Flutter SDK and packages that your app depends on, execute the flutter upgrade  command in the app root directory  (the pubspec.yaml  same as the directory containing the  files):
640?wx_fmt=png
This command first gets the latest Flutter SDK version available on your Flutter channel. Then this command updates every package your app depends on to the latest compatible version.
If you want to use a newer Flutter SDK version, switch to the unstable Flutter channel and run it  flutter upgrade .
3. Switch Flutter release channel
Flutter has 4 release channels, namely stable, beta, dev, and master. We recommend using the stable channel unless you need a newer version.
To see which channel you are currently using, use the following command:
640?wx_fmt=png
To switch to another channel, use  flutter channel <channel-name> . After you switch channels, use to  flutter upgrade  download the Flutter SDK and dependent packages. E.g:

640?wx_fmt=png

Memo 
If you need a specific Flutter SDK version, you can download it from the Flutter SDK archive page.
4. Update packages only
If you have modified the  pubspec.yaml  file, or you want to update only the packages that your app depends on (instead of updating the packages and the Flutter SDK at the same time), use  flutter pub  one of the commands.
In order to get  pubspec.yaml  all the dependencies listed in the file, but exclude unnecessary updates, use the  get  command:

640?wx_fmt=png

In order to update  pubspec.yaml  all dependencies listed in the file to the latest compatible version, use the  upgrade  command:

640?wx_fmt=png

5. Get the latest notifications
We will post announcements of major changes on the Flutter announcements mailing list. You can also ask questions on the Flutter dev mailing list! In addition to subscribing to receive announcements, we would be happy to hear from you!
link:
https://groups.google.com/forum/#!forum/flutter-dev
6. Select a specific version
If you want to switch to a specific version of Flutter, you can use the  flutter version  command:

640?wx_fmt=png

To force the use of a certain version of the package, please pubspec.yaml  indicate its version in the  file.
We will notify the latest breaking changes (major changes) to the Flutter notification mail group. At the same time, you can ask you questions in the Flutter developer mail group. We hope to get your feedback!
Flutter notification mail group:
https://groups.google.com/forum/#!forum/flutter-announce
Flutter Developer Mail Group:
https://groups.google.com/forum/#!forum/flutter-dev

640?wx_fmt=png

Guess you like

Origin blog.csdn.net/weixin_43459071/article/details/102908691