Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to update single package in pubspec.yaml file in Flutter

Tags:

flutter

dart

Let's say I'm having two packages in my pubspec.yaml file.

abc: any
xyz: any

Now, I only want to update abc package, how do I do that, is there any command like

flutter update abc
like image 877
iDecode Avatar asked Jan 20 '20 11:01

iDecode


2 Answers

To upgrade abc package and leaving others as it is, run:

dart pub upgrade abc

To upgrade all the packages, run:

dart pub upgrade
like image 141
iDecode Avatar answered Nov 04 '22 15:11

iDecode


First, comment that the packaging line in the pubspec.yaml file and run flutter pub get after successfully get packages to uncomment that line (if you want to upgrade/downgrade to a specific version that mentioned version too) it will upgrade to the latest version.

In your case:

step 1:

// abc: any
   xyz: any
  • run flutter pub get

step 2:

  abd: any
  xyz: any

So now abc will upgrade to the latest version

like image 45
Dhaval Kansara Avatar answered Nov 04 '22 14:11

Dhaval Kansara