Rename `flutter packages` to `flutter pub` (#33041)

diff --git a/dev/bots/analyze-sample-code.dart b/dev/bots/analyze-sample-code.dart
index 23a9758..6304d49 100644
--- a/dev/bots/analyze-sample-code.dart
+++ b/dev/bots/analyze-sample-code.dart
@@ -565,7 +565,7 @@
     if (stdout.isNotEmpty && stdout.first == 'Building flutter tool...') {
       stdout.removeAt(0);
     }
-    if (stdout.isNotEmpty && stdout.first.startsWith('Running "flutter packages get" in ')) {
+    if (stdout.isNotEmpty && stdout.first.startsWith('Running "flutter pub get" in ')) {
       stdout.removeAt(0);
     }
     _exitCode = result.exitCode;
diff --git a/dev/bots/docs.sh b/dev/bots/docs.sh
index 79cd279..7a865cf 100755
--- a/dev/bots/docs.sh
+++ b/dev/bots/docs.sh
@@ -108,7 +108,7 @@
 
 # This script generates a unified doc set, and creates
 # a custom index.html, placing everything into dev/docs/doc.
-(cd "$FLUTTER_ROOT/dev/tools" && "$FLUTTER" packages get)
+(cd "$FLUTTER_ROOT/dev/tools" && "$FLUTTER" pub get)
 (cd "$FLUTTER_ROOT/dev/tools" && "$PUB" get)
 (cd "$FLUTTER_ROOT" && "$DART" "$FLUTTER_ROOT/dev/tools/dartdoc.dart")
 (cd "$FLUTTER_ROOT" && "$DART" "$FLUTTER_ROOT/dev/tools/java_and_objc_doc.dart")
diff --git a/dev/devicelab/bin/tasks/flutter_test_performance.dart b/dev/devicelab/bin/tasks/flutter_test_performance.dart
index 3843f1c..f84e071 100644
--- a/dev/devicelab/bin/tasks/flutter_test_performance.dart
+++ b/dev/devicelab/bin/tasks/flutter_test_performance.dart
@@ -59,7 +59,7 @@
       step = TestStep.buildingFlutterTool;
     } else if (step == TestStep.testPassed && entry.contains('Collecting coverage information...')) {
       // ignore this line
-    } else if (step.index < TestStep.runningPubGet.index && entry == 'Running "flutter packages get" in automated_tests...') {
+    } else if (step.index < TestStep.runningPubGet.index && entry == 'Running "flutter pub get" in automated_tests...') {
       // ignore this line
       step = TestStep.runningPubGet;
     } else if (step.index < TestStep.testWritesFirstCarriageReturn.index && entry == '') {
diff --git a/dev/devicelab/bin/tasks/run_release_test.dart b/dev/devicelab/bin/tasks/run_release_test.dart
index 8f26511..92daff3 100644
--- a/dev/devicelab/bin/tasks/run_release_test.dart
+++ b/dev/devicelab/bin/tasks/run_release_test.dart
@@ -54,7 +54,7 @@
         throw 'flutter run --release had output on standard error.';
       if (stdout.first.startsWith('Building flutter tool...'))
         stdout.removeAt(0);
-      if (stdout.first.startsWith('Running "flutter packages get" in ui...'))
+      if (stdout.first.startsWith('Running "flutter pub get" in ui...'))
         stdout.removeAt(0);
       if (stdout.first.startsWith('Initializing gradle...'))
         stdout.removeAt(0);
diff --git a/dev/integration_tests/android_views/ios/Podfile b/dev/integration_tests/android_views/ios/Podfile
index d077b08..f1f7194 100644
--- a/dev/integration_tests/android_views/ios/Podfile
+++ b/dev/integration_tests/android_views/ios/Podfile
@@ -41,7 +41,7 @@
   # Flutter Pods
   generated_xcode_build_settings = parse_KV_file('./Flutter/Generated.xcconfig')
   if generated_xcode_build_settings.empty?
-    puts "Generated.xcconfig must exist. If you're running pod install manually, make sure flutter packages get is executed first."
+    puts "Generated.xcconfig must exist. If you're running pod install manually, make sure flutter pub get is executed first."
   end
   generated_xcode_build_settings.map { |p|
     if p[:name] == 'FLUTTER_FRAMEWORK_DIR'
diff --git a/examples/flutter_gallery/README.md b/examples/flutter_gallery/README.md
index 627ba63..3f9b48a 100644
--- a/examples/flutter_gallery/README.md
+++ b/examples/flutter_gallery/README.md
@@ -16,7 +16,7 @@
 ### Building and installing the Flutter app
 
 * `cd $FLUTTER_ROOT/examples/flutter_gallery`
-* `flutter packages get`
+* `flutter pub get`
 * `flutter run --release`
 
 The `flutter run --release` command both builds and installs the Flutter app.
diff --git a/examples/platform_view/ios/Podfile b/examples/platform_view/ios/Podfile
index b44ccaa..dcc6b98 100644
--- a/examples/platform_view/ios/Podfile
+++ b/examples/platform_view/ios/Podfile
@@ -35,7 +35,7 @@
   # Flutter Pods
   generated_xcode_build_settings = parse_KV_file('./Flutter/Generated.xcconfig')
   if generated_xcode_build_settings.empty?
-    puts "Generated.xcconfig must exist. If you're running pod install manually, make sure flutter packages get is executed first."
+    puts "Generated.xcconfig must exist. If you're running pod install manually, make sure flutter pub get is executed first."
   end
   generated_xcode_build_settings.map { |p|
     if p[:name] == 'FLUTTER_FRAMEWORK_DIR'
diff --git a/examples/stocks/README.md b/examples/stocks/README.md
index 3b0da73..d8d0785 100644
--- a/examples/stocks/README.md
+++ b/examples/stocks/README.md
@@ -15,7 +15,7 @@
 ### Building and installing the stocks demo app
 
 * `cd $FLUTTER_ROOT/examples/stocks`
-* `flutter packages get`
+* `flutter pub get`
 * `flutter run --release`
 
 The `flutter run --release` command both builds and installs the Flutter app.
diff --git a/packages/flutter_tools/lib/src/commands/create.dart b/packages/flutter_tools/lib/src/commands/create.dart
index da642b5..771ea15 100644
--- a/packages/flutter_tools/lib/src/commands/create.dart
+++ b/packages/flutter_tools/lib/src/commands/create.dart
@@ -56,11 +56,11 @@
   CreateCommand() {
     argParser.addFlag('pub',
       defaultsTo: true,
-      help: 'Whether to run "flutter packages get" after the project has been created.',
+      help: 'Whether to run "flutter pub get" after the project has been created.',
     );
     argParser.addFlag('offline',
       defaultsTo: false,
-      help: 'When "flutter packages get" is run by the create command, this indicates '
+      help: 'When "flutter pub get" is run by the create command, this indicates '
         'whether to run it in offline mode or not. In offline mode, it will need to '
         'have all dependencies already available in the pub cache to succeed.',
     );
diff --git a/packages/flutter_tools/lib/src/commands/packages.dart b/packages/flutter_tools/lib/src/commands/packages.dart
index 19c51d6..bdf266f 100644
--- a/packages/flutter_tools/lib/src/commands/packages.dart
+++ b/packages/flutter_tools/lib/src/commands/packages.dart
@@ -27,10 +27,10 @@
   }
 
   @override
-  final String name = 'packages';
+  final String name = 'pub';
 
   @override
-  List<String> get aliases => const <String>['pub'];
+  List<String> get aliases => const <String>['packages'];
 
   @override
   final String description = 'Commands for managing Flutter packages.';
@@ -65,7 +65,7 @@
 
   @override
   String get invocation {
-    return '${runner.executableName} packages $name [<target directory>]';
+    return '${runner.executableName} pub $name [<target directory>]';
   }
 
   Future<void> _runPubGet (String directory) async {
@@ -127,7 +127,7 @@
 
   @override
   String get invocation {
-    return '${runner.executableName} packages test [<tests...>]';
+    return '${runner.executableName} pub test [<tests...>]';
   }
 
   @override
@@ -157,7 +157,7 @@
 
   @override
   String get invocation {
-    return '${runner.executableName} packages $_commandName [<arguments...>]';
+    return '${runner.executableName} pub $_commandName [<arguments...>]';
   }
 
   @override
diff --git a/packages/flutter_tools/lib/src/dart/package_map.dart b/packages/flutter_tools/lib/src/dart/package_map.dart
index fafb4e8..f1057d3 100644
--- a/packages/flutter_tools/lib/src/dart/package_map.dart
+++ b/packages/flutter_tools/lib/src/dart/package_map.dart
@@ -64,7 +64,7 @@
     String message = '$packagesPath does not exist.';
     final String pubspecPath = fs.path.absolute(fs.path.dirname(packagesPath), 'pubspec.yaml');
     if (fs.isFileSync(pubspecPath))
-      message += '\nDid you run "flutter packages get" in this directory?';
+      message += '\nDid you run "flutter pub get" in this directory?';
     else
       message += '\nDid you run this command from the same directory as your pubspec.yaml file?';
     return message;
diff --git a/packages/flutter_tools/lib/src/dart/pub.dart b/packages/flutter_tools/lib/src/dart/pub.dart
index 5c53c2c..7cd554b 100644
--- a/packages/flutter_tools/lib/src/dart/pub.dart
+++ b/packages/flutter_tools/lib/src/dart/pub.dart
@@ -93,7 +93,7 @@
   if (!checkLastModified || _shouldRunPubGet(pubSpecYaml: pubSpecYaml, dotPackages: dotPackages)) {
     final String command = upgrade ? 'upgrade' : 'get';
     final Status status = logger.startProgress(
-      'Running "flutter packages $command" in ${fs.path.basename(directory)}...',
+      'Running "flutter pub $command" in ${fs.path.basename(directory)}...',
       timeout: timeoutConfiguration.slowOperation,
     );
     final List<String> args = <String>['--verbosity=warning'];
diff --git a/packages/flutter_tools/lib/src/runner/flutter_command.dart b/packages/flutter_tools/lib/src/runner/flutter_command.dart
index b345f78..bd00937 100644
--- a/packages/flutter_tools/lib/src/runner/flutter_command.dart
+++ b/packages/flutter_tools/lib/src/runner/flutter_command.dart
@@ -139,7 +139,7 @@
   void usesPubOption() {
     argParser.addFlag('pub',
       defaultsTo: true,
-      help: 'Whether to run "flutter packages get" before executing this command.');
+      help: 'Whether to run "flutter pub get" before executing this command.');
     _usesPubOption = true;
   }
 
@@ -594,7 +594,7 @@
       }
 
       // Validate the current package map only if we will not be running "pub get" later.
-      if (parent?.name != 'packages' && !(_usesPubOption && argResults['pub'])) {
+      if (parent?.name != 'pub' && !(_usesPubOption && argResults['pub'])) {
         final String error = PackageMap(PackageMap.globalPackagesPath).checkValid();
         if (error != null)
           throw ToolExit(error);
diff --git a/packages/flutter_tools/templates/cocoapods/Podfile-objc b/packages/flutter_tools/templates/cocoapods/Podfile-objc
index d077b08..f1f7194 100644
--- a/packages/flutter_tools/templates/cocoapods/Podfile-objc
+++ b/packages/flutter_tools/templates/cocoapods/Podfile-objc
@@ -41,7 +41,7 @@
   # Flutter Pods
   generated_xcode_build_settings = parse_KV_file('./Flutter/Generated.xcconfig')
   if generated_xcode_build_settings.empty?
-    puts "Generated.xcconfig must exist. If you're running pod install manually, make sure flutter packages get is executed first."
+    puts "Generated.xcconfig must exist. If you're running pod install manually, make sure flutter pub get is executed first."
   end
   generated_xcode_build_settings.map { |p|
     if p[:name] == 'FLUTTER_FRAMEWORK_DIR'
diff --git a/packages/flutter_tools/templates/cocoapods/Podfile-swift b/packages/flutter_tools/templates/cocoapods/Podfile-swift
index 64eddc6..3f49388 100644
--- a/packages/flutter_tools/templates/cocoapods/Podfile-swift
+++ b/packages/flutter_tools/templates/cocoapods/Podfile-swift
@@ -43,7 +43,7 @@
   # Flutter Pods
   generated_xcode_build_settings = parse_KV_file('./Flutter/Generated.xcconfig')
   if generated_xcode_build_settings.empty?
-    puts "Generated.xcconfig must exist. If you're running pod install manually, make sure flutter packages get is executed first."
+    puts "Generated.xcconfig must exist. If you're running pod install manually, make sure flutter pub get is executed first."
   end
   generated_xcode_build_settings.map { |p|
     if p[:name] == 'FLUTTER_FRAMEWORK_DIR'
diff --git a/packages/flutter_tools/templates/module/ios/library/Flutter.tmpl/podhelper.rb b/packages/flutter_tools/templates/module/ios/library/Flutter.tmpl/podhelper.rb
index ad4c50b..3956697 100644
--- a/packages/flutter_tools/templates/module/ios/library/Flutter.tmpl/podhelper.rb
+++ b/packages/flutter_tools/templates/module/ios/library/Flutter.tmpl/podhelper.rb
@@ -23,7 +23,7 @@
 def flutter_root(f)
     generated_xcode_build_settings = parse_KV_file(File.join(f, File.join('.ios', 'Flutter', 'Generated.xcconfig')))
     if generated_xcode_build_settings.empty?
-        puts "Generated.xcconfig must exist. Make sure `flutter packages get` is executed in #{f}."
+        puts "Generated.xcconfig must exist. Make sure `flutter pub get` is executed in #{f}."
         exit
     end
     generated_xcode_build_settings.map { |p|
diff --git a/packages/flutter_tools/test/commands/test_test.dart b/packages/flutter_tools/test/commands/test_test.dart
index 951b34e..8b7ad9d 100644
--- a/packages/flutter_tools/test/commands/test_test.dart
+++ b/packages/flutter_tools/test/commands/test_test.dart
@@ -106,7 +106,7 @@
   final List<String> output = exec.stdout.split('\n');
   if (output.first == 'Waiting for another flutter command to release the startup lock...')
     output.removeAt(0);
-  if (output.first.startsWith('Running "flutter packages get" in'))
+  if (output.first.startsWith('Running "flutter pub get" in'))
     output.removeAt(0);
   output.add('<<stderr>>');
   output.addAll(exec.stderr.split('\n'));
diff --git a/packages/flutter_tools/test/dart/pub_get_test.dart b/packages/flutter_tools/test/dart/pub_get_test.dart
index ef278b3..67cf5d0 100644
--- a/packages/flutter_tools/test/dart/pub_get_test.dart
+++ b/packages/flutter_tools/test/dart/pub_get_test.dart
@@ -39,26 +39,26 @@
       });
       time.elapse(const Duration(milliseconds: 500));
       expect(testLogger.statusText,
-        'Running "flutter packages get" in /...\n'
+        'Running "flutter pub get" in /...\n'
         'pub get failed (69) -- attempting retry 1 in 1 second...\n',
       );
       expect(processMock.lastPubEnvironment, contains('flutter_cli:flutter_tests'));
       expect(processMock.lastPubCache, isNull);
       time.elapse(const Duration(milliseconds: 500));
       expect(testLogger.statusText,
-        'Running "flutter packages get" in /...\n'
+        'Running "flutter pub get" in /...\n'
         'pub get failed (69) -- attempting retry 1 in 1 second...\n'
         'pub get failed (69) -- attempting retry 2 in 2 seconds...\n',
       );
       time.elapse(const Duration(seconds: 1));
       expect(testLogger.statusText,
-        'Running "flutter packages get" in /...\n'
+        'Running "flutter pub get" in /...\n'
         'pub get failed (69) -- attempting retry 1 in 1 second...\n'
         'pub get failed (69) -- attempting retry 2 in 2 seconds...\n',
       );
       time.elapse(const Duration(seconds: 100)); // from t=0 to t=100
       expect(testLogger.statusText,
-        'Running "flutter packages get" in /...\n'
+        'Running "flutter pub get" in /...\n'
         'pub get failed (69) -- attempting retry 1 in 1 second...\n'
         'pub get failed (69) -- attempting retry 2 in 2 seconds...\n'
         'pub get failed (69) -- attempting retry 3 in 4 seconds...\n' // at t=1
@@ -69,7 +69,7 @@
       );
       time.elapse(const Duration(seconds: 200)); // from t=0 to t=200
       expect(testLogger.statusText,
-        'Running "flutter packages get" in /...\n'
+        'Running "flutter pub get" in /...\n'
         'pub get failed (69) -- attempting retry 1 in 1 second...\n'
         'pub get failed (69) -- attempting retry 2 in 2 seconds...\n'
         'pub get failed (69) -- attempting retry 3 in 4 seconds...\n'
diff --git a/packages/flutter_tools/test/integration/test_utils.dart b/packages/flutter_tools/test/integration/test_utils.dart
index 4af1c03..fc63cfe 100644
--- a/packages/flutter_tools/test/integration/test_utils.dart
+++ b/packages/flutter_tools/test/integration/test_utils.dart
@@ -43,7 +43,7 @@
 Future<void> getPackages(String folder) async {
   final List<String> command = <String>[
     fs.path.join(getFlutterRoot(), 'bin', 'flutter'),
-    'packages',
+    'pub',
     'get',
   ];
   final Process process = await processManager.start(command, workingDirectory: folder);
@@ -52,5 +52,5 @@
   final int exitCode = await process.exitCode;
   if (exitCode != 0)
     throw Exception(
-        'flutter packages get failed: ${errorOutput.toString()}');
+        'flutter pub get failed: ${errorOutput.toString()}');
 }
diff --git a/packages/flutter_tools/test/ios/mac_test.dart b/packages/flutter_tools/test/ios/mac_test.dart
index 7f232e8..9d4f75f 100644
--- a/packages/flutter_tools/test/ios/mac_test.dart
+++ b/packages/flutter_tools/test/ios/mac_test.dart
@@ -360,7 +360,7 @@
       final XcodeBuildResult buildResult = XcodeBuildResult(
         success: false,
         stdout: '''
-Running "flutter packages get" in flutter_gallery...  0.6s
+Running "flutter pub get" in flutter_gallery...  0.6s
 Launching lib/main.dart on x in release mode...
 Running pod install...                                1.2s
 Running Xcode build...                                1.4s