What is the difference between `flutter packages get` and `flutter pub get`?
They are the same.
flutter packages
used to support only two subcommands including flutter packages get
, but more commands were added later on.
And then, flutter packages
was renamed to flutter pub
. The former is now just an alias for the latter.
flutter packages get
was not affected by the first change as it had already existed at that point, and its functionality has not been affected by the second change either as it was just a rename.
The pub
command is specific to dart and is a set of tools for managing dart packages. You can get an explanation about it and its usage here.
pub get
is shorthand for the pub get packages
which is how packages are downloaded in dart projects. Adding the flutter keyword before it makes it so that the command is run by the flutter SDK, which will map it to the sdk's packages get command. Reference
As for using the two, they can be used interchangeably as the Flutter SDK will automatically change flutter pub get
to flutter packages get
inside flutter projects, and I imagine the change in Android studio is semantic in nature to make it more inline with typical dart style as dart developers will be used to running pub get
.
They both do the same thing. To prove this I created two exact same new projects and added exact dependencies
dependencies:
image_picker: ^0.6.4
Now in one of the project I ran the command flutter pub get
and in another one flutter packages get
, both of them in verbose mode to check what is happening behind the scenes.
I could see logically no difference at all except those time taken to execute(which doesn't matter). The rest of the contents in the file as exactly the same.
So yes, they are doing the same thing