There’s so much more than flutter pub get
If you’ve been working with Flutter for any length of time, you’ve probably run flutter pub get
in the terminal or at least seen a popup about it from your IDE. The Pub tool has a lot more than just get to offer you, though. Pub is the official repository for the Flutter and Dart packages available at pub.dev, and pub is your command line interface to that repository. This article will introduce the many options that are available with the Pub tool.
Overview
Assuming you have a recent version of Flutter and Dart installed and in your path, open a terminal and run the following command to see all the options that pub offers:
flutter pub -h
The -h
means help. You can also use --help
instead.
Here is the printout:
add Add a dependency to pubspec.yaml..
cache Work with the Pub system cache.
deps Print package dependencies.
downgrade Downgrade packages in a Flutter project.
get Get packages in a Flutter project.
global Work with Pub global packages.
login Log into pub.dev..
logout Log out of pub.dev..
outdated Analyze dependencies to find which ones can be upgraded.
pub Pass the remaining arguments…