運行flutter可能遇到的問題

  1. cd 到flutter 的目錄下
  2. 幫助命令
    flutter -h
    執(zhí)行后內容顯示為
    Manage your Flutter app development.

Common commands:

flutter create <output directory>
Create a new Flutter project in the specified directory.

flutter run [options]
Run your Flutter application on an attached device or in an emulator.

Usage: flutter <command> [arguments]

Global options:
-h, --help Print this usage information.
-v, --verbose Noisy logging, including all shell commands
executed.
If used with --help, shows hidden options.

-d, --device-id Target device id or name (prefixes allowed).
--version Reports the version of this tool.
--suppress-analytics Suppress analytics reporting when this command runs.
--bug-report Captures a bug report file to submit to the Flutter
team.
Contains local paths, device identifiers, and log
snippets.

Available commands:
analyze Analyze the project's Dart code.
attach Attach to a running application.
bash-completion Output command line shell completion setup scripts.
build Flutter build commands.
channel List or switch flutter channels.
clean Delete the build/ and .dart_tool/ directories.
config Configure Flutter settings.
create Create a new Flutter project.
devices List all connected devices.
doctor Show information about the installed tooling.
drive Runs Flutter Driver tests for the current project.
emulators List, launch and create emulators.
format Format one or more dart files.
help Display help information for flutter.
install Install a Flutter app on an attached device.
logs Show log output for running Flutter apps.
make-host-app-editable Moves host apps from generated directories to
non-generated directories so that they can be edited
by developers.
packages Commands for managing Flutter packages.
precache Populates the Flutter tool's cache of binary
artifacts.
run Run your Flutter app on an attached device.
screenshot Take a screenshot from a connected device.
stop Stop your Flutter app on an attached device.
test Run Flutter unit tests for the current project.
trace Start and stop tracing for a running Flutter app.
upgrade Upgrade your copy of Flutter.
version List or switch flutter versions.

Run "flutter help <command>" for more information about a command.
Run "flutter help -v" for verbose help output, including less commonly used
options.

3.顯示本機的模擬器
flutter emulators
執(zhí)行后顯示內容
2 available emulators:

Nexus_6_API_26 ? Nexus 6 ? Google ? Nexus 6 API 26
apple_ios_simulator ? iOS Simulator ? Apple

To run an emulator, run 'flutter emulators --launch <emulator id>'.
To create a new emulator, run 'flutter emulators --create [--name xyz]'.

You can find more information on managing emulators at the links below:
https://developer.android.com/studio/run/managing-avds
https://developer.android.com/studio/command-line/avdmanager

4.啟動本機的模擬器(當前啟動的是ios模擬器)
flutter emulator --launch apple_ios_simulator

5.遠程更新package
pubspec.yaml會依賴一些遠程庫侥蒙,這邊相當于將遠程的依賴下載到本地拣展。
flutter packages get

如果提示以下內容
Error: No pubspec.yaml file found.
This command should be run from the root of your Flutter project.
Do not run this command from the root of your git clone of Flutter.
說明pubspec.yaml文件不在根目錄下捕儒,這時候需要執(zhí)行cd命令到工程目錄

6.運行應用到模擬器上
flutter run

7.熱重載
先保存代碼commad+s
然后在 terminal中輸入r
執(zhí)行后界面內容更新

8.停止運行
control+z

9.VSCode中常用的快捷鍵
R 鍵重新啟動
r 鍵熱重載
q 退出
p 顯示網格
P 顯示幀率
o 切換Android與iOS的預覽模式

?著作權歸作者所有,轉載或內容合作請聯系作者
  • 序言:七十年代末,一起剝皮案震驚了整個濱河市,隨后出現的幾起案子桑孩,更是在濱河造成了極大的恐慌倒堕,老刑警劉巖,帶你破解...
    沈念sama閱讀 217,406評論 6 503
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件丰包,死亡現場離奇詭異禁熏,居然都是意外死亡,警方通過查閱死者的電腦和手機邑彪,發(fā)現死者居然都...
    沈念sama閱讀 92,732評論 3 393
  • 文/潘曉璐 我一進店門瞧毙,熙熙樓的掌柜王于貴愁眉苦臉地迎上來,“玉大人,你說我怎么就攤上這事宙彪【囟” “怎么了?”我有些...
    開封第一講書人閱讀 163,711評論 0 353
  • 文/不壞的土叔 我叫張陵释漆,是天一觀的道長悲没。 經常有香客問我,道長男图,這世上最難降的妖魔是什么示姿? 我笑而不...
    開封第一講書人閱讀 58,380評論 1 293
  • 正文 為了忘掉前任,我火速辦了婚禮逊笆,結果婚禮上栈戳,老公的妹妹穿的比我還像新娘。我一直安慰自己难裆,他們只是感情好子檀,可當我...
    茶點故事閱讀 67,432評論 6 392
  • 文/花漫 我一把揭開白布。 她就那樣靜靜地躺著乃戈,像睡著了一般命锄。 火紅的嫁衣襯著肌膚如雪。 梳的紋絲不亂的頭發(fā)上偏化,一...
    開封第一講書人閱讀 51,301評論 1 301
  • 那天脐恩,我揣著相機與錄音,去河邊找鬼侦讨。 笑死驶冒,一個胖子當著我的面吹牛,可吹牛的內容都是我干的韵卤。 我是一名探鬼主播骗污,決...
    沈念sama閱讀 40,145評論 3 418
  • 文/蒼蘭香墨 我猛地睜開眼,長吁一口氣:“原來是場噩夢啊……” “哼沈条!你這毒婦竟也來了需忿?” 一聲冷哼從身側響起,我...
    開封第一講書人閱讀 39,008評論 0 276
  • 序言:老撾萬榮一對情侶失蹤,失蹤者是張志新(化名)和其女友劉穎,沒想到半個月后对扶,有當地人在樹林里發(fā)現了一具尸體,經...
    沈念sama閱讀 45,443評論 1 314
  • 正文 獨居荒郊野嶺守林人離奇死亡汗洒,尸身上長有42處帶血的膿包…… 初始之章·張勛 以下內容為張勛視角 年9月15日...
    茶點故事閱讀 37,649評論 3 334
  • 正文 我和宋清朗相戀三年,在試婚紗的時候發(fā)現自己被綠了父款。 大學時的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片溢谤。...
    茶點故事閱讀 39,795評論 1 347
  • 序言:一個原本活蹦亂跳的男人離奇死亡瞻凤,死狀恐怖,靈堂內的尸體忽然破棺而出世杀,到底是詐尸還是另有隱情阀参,我是刑警寧澤,帶...
    沈念sama閱讀 35,501評論 5 345
  • 正文 年R本政府宣布瞻坝,位于F島的核電站蛛壳,受9級特大地震影響,放射性物質發(fā)生泄漏湿镀。R本人自食惡果不足惜,卻給世界環(huán)境...
    茶點故事閱讀 41,119評論 3 328
  • 文/蒙蒙 一伐憾、第九天 我趴在偏房一處隱蔽的房頂上張望勉痴。 院中可真熱鬧,春花似錦树肃、人聲如沸蒸矛。這莊子的主人今日做“春日...
    開封第一講書人閱讀 31,731評論 0 22
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽雏掠。三九已至,卻和暖如春劣像,著一層夾襖步出監(jiān)牢的瞬間乡话,已是汗流浹背。 一陣腳步聲響...
    開封第一講書人閱讀 32,865評論 1 269
  • 我被黑心中介騙來泰國打工耳奕, 沒想到剛下飛機就差點兒被人妖公主榨干…… 1. 我叫王不留绑青,地道東北人。 一個月前我還...
    沈念sama閱讀 47,899評論 2 370
  • 正文 我出身青樓屋群,卻偏偏與公主長得像闸婴,于是被迫代替她去往敵國和親。 傳聞我的和親對象是個殘疾皇子芍躏,可洞房花燭夜當晚...
    茶點故事閱讀 44,724評論 2 354

推薦閱讀更多精彩內容