flutter run 和 flutter run -d 的区别

时间:2021-04-04 15:33:47

标签: flutter

AFAIK,当您运行以下命令时,它会在调试模式下运行应用程序。

flutter run 

但是下面的命令也做同样的事情。那么,这两个命令有什么区别吗?

flutter run -d

1 个答案:

答案 0 :(得分:2)

-d 允许您指定运行目标,例如flutter run -d webflutter run -d linux

$ flutter run linux   
Target file "linux" not found.

$ flutter run -d linux
Launching lib/main.dart on Linux in debug mode...
Building Linux application...  
$ flutter run --help
Run your Flutter app on an attached device.

Global options:
-d, --device-id             Target device id or name (prefixes allowed).

Command(没有 linux-d 部分)默认是一个 --target 标志:

-t, --target=<path>                   The main entry-point file of the application, as run on the device.
                                      If the --target option is omitted, but a file name is provided on the command line, then that is used instead.
                                      (defaults to "lib/main.dart")