Home > front end >  Differences dart pub get and flutter pub get
Differences dart pub get and flutter pub get

Time:12-27

I have been using flutter pub get for updating pubspect.yaml Now I have found that there is a similar command dart pub get

What are the differences between these two commands?

CodePudding user response:

using flutter pub get you are getting dart packages for flutter

using dart pub get you are getting simple dart libs(packages)

you can create dart projects without flutter..and there y'll need do "Dart pub get"

every flutter project is a dart project but not every dart project is a flutter project

CodePudding user response:

When dart pub get gets new dependencies, it writes a lockfile to ensure that future gets will use the same versions of those dependencies. Application packages should check in the lockfile to source control; this ensures the application will use the exact same versions of all dependencies for all developers and when deployed to production. Library packages should not check in the lockfile, though, since they’re expected to work with a range of dependency versions.

If a lockfile already exists, dart pub get uses the versions of dependencies locked in it if possible. If a dependency isn’t locked, pub gets the latest version of that dependency that satisfies all the version constraints. This is the primary difference between dart pub get and dart pub upgrade, which always tries to get the latest versions of all dependencies.


When running flutter pub get (Packages get in IntelliJ or Android Studio) for the first time after adding a package, Flutter saves the concrete package version found in the pubspec. lock lockfile. This ensures that you get the same version again if you, or another developer on your team, run flutter pub get .

  • Related