iDecode
iDecode

Reputation: 28996

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

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

Upvotes: 26

Views: 20236

Answers (4)

iDecode
iDecode

Reputation: 28996

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

dart pub upgrade abc

To upgrade all the packages, run:

dart pub upgrade

Upvotes: 33

Dhaval Kansara
Dhaval Kansara

Reputation: 3911

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

Upvotes: 4

mjhansen3
mjhansen3

Reputation: 1003

Run this command in the terminal

pub upgrade abc args

where abc is the package name you want to upgrade. Be sure you are in the project root directory.

Upvotes: 0

Related Questions