简体   繁体   中英

Is there a shortcut to run `flutter pub get` in Android Studio?

Sometimes when I switch branches, the IDE shows errors in Dart files. In Android or iOS dev, I'd do a clean and rebuild. Or a "gradle sync".

I've found that the closest equivalents are flutter doctor and flutter pub get . In my issue mentioned above, flutter pub get fixes it and runs quickly.

Is there a shortcut or button to quickly run this from Android Studio? I know I can type it into terminal, but would love a shortcut.

I've found a few options. Sadly there is no button and I haven't found a plugin that adds one. But I've found the next closest thing.

Option 1 (action search)

  1. Run the "Search Everywhere" command (which searches actions). For me, it is double shift .
  2. Type "pub get" and press enter

This will run the command found in Tools -> Flutter -> Flutter Pub Get

Option 2 (shortcut)

Using the same option above, you can use a keymap.

  1. Go to Settings ( cmd +, ) -> Keymap
  2. Search for "pub get"
  3. Bind it to whatever you want (I did ctrl + b )

Option 3 (Flutter Enhancement)

Using the Android Studio plugin Flutter Enhancement Suite .

  1. Download Flutter Enhancement Suite
  2. Right-click the lib directory and select "Run Pub Get"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM