2023-02-09 flutter命令执行流程

2023-02-08  本文已影响0人  我是小胡胡123

研究flutter xxx和dart xxx区别。

exec 

/Volumes/xx/myshared/opt/fvm/versions/3.0.5/bin/cache/dart-sdk/bin/dart 

--disable-dart-dev 


--packages=/Volumes/xx/myshared/opt/fvm/versions/3.0.5/packages/flutter_tools/.packages  


/Volumes/xx/myshared/opt/fvm/versions/3.0.5/bin/cache/flutter_tools.snapshot 


--version

简化为

dart --disable-dart-dev --packages=.packages  flutter_tools.snapshot --version
exec /Volumes/xx/myshared/opt/fvm/versions/3.0.5/bin/cache/dart-sdk/bin/dart --version

简化为
dart --version

可用:
flutter packages pub publish
flutter pub publish
dart pub publish

不可以用:
dart packages pub publish

flutter的各种命令:

0 = {map entry} "help" -> [HelpCommand]
1 = {map entry} "analyze" -> [AnalyzeCommand]
2 = {map entry} "assemble" -> [AssembleCommand]
3 = {map entry} "attach" -> [AttachCommand]
4 = {map entry} "build" -> [BuildCommand]
5 = {map entry} "channel" -> [ChannelCommand]
6 = {map entry} "clean" -> [CleanCommand]
7 = {map entry} "config" -> [ConfigCommand]
8 = {map entry} "configure" -> [ConfigCommand]
9 = {map entry} "custom-devices" -> [CustomDevicesCommand]
10 = {map entry} "create" -> [CreateCommand]
11 = {map entry} "daemon" -> [DaemonCommand]
12 = {map entry} "debug-adapter" -> [DebugAdapterCommand]
13 = {map entry} "debug_adapter" -> [DebugAdapterCommand]
14 = {map entry} "devices" -> [DevicesCommand]
15 = {map entry} "doctor" -> [DoctorCommand]
16 = {map entry} "downgrade" -> [DowngradeCommand]
17 = {map entry} "drive" -> [DriveCommand]
18 = {map entry} "driver" -> [DriveCommand]
19 = {map entry} "emulators" -> [EmulatorsCommand]
20 = {map entry} "emulator" -> [EmulatorsCommand]
21 = {map entry} "format" -> [FormatCommand]
22 = {map entry} "dartfmt" -> [FormatCommand]
23 = {map entry} "generate" -> [GenerateCommand]
24 = {map entry} "gen-l10n" -> [GenerateLocalizationsCommand]
25 = {map entry} "install" -> [InstallCommand]
26 = {map entry} "logs" -> [LogsCommand]
27 = {map entry} "make-host-app-editable" -> [MakeHostAppEditableCommand]
28 = {map entry} "pub" -> [PackagesCommand]
29 = {map entry} "packages" -> [PackagesCommand]
30 = {map entry} "precache" -> [PrecacheCommand]
31 = {map entry} "run" -> [RunCommand]
32 = {map entry} "screenshot" -> [ScreenshotCommand]
33 = {map entry} "pic" -> [ScreenshotCommand]
34 = {map entry} "bash-completion" -> [ShellCompletionCommand]
35 = {map entry} "zsh-completion" -> [ShellCompletionCommand]
36 = {map entry} "test" -> [TestCommand]
37 = {map entry} "upgrade" -> [UpgradeCommand]
38 = {map entry} "symbolize" -> [SymbolizeCommand]
39 = {map entry} "ide-config" -> [IdeConfigCommand]
40 = {map entry} "update-packages" -> [UpdatePackagesCommand]
41 = {map entry} "upgrade-packages" -> [UpdatePackagesCommand]

flutter pub publish:
command = {PackagesForwardCommand}

flutter packages pub publish:
command = {PackagesPassthroughCommand}

/Volumes/xxx/myshared/opt/fvm/current/bin/cache/dart-sdk/bin/dart

flutter 命令最终会转化为
flutter_tools.dart->
process_manager.dart

  @override
  bool canRun(dynamic executable, {String? workingDirectory}) {
    return _runSync(
      () => _delegate.canRun(executable, workingDirectory: workingDirectory),
      platform: _platform,
      failureMessage: 'Flutter failed to run "$executable"',
      posixPermissionSuggestion: 'Try running:\n'
          '  sudo chown -R \$(whoami) $executable && chmod u+rx $executable',
    );
  }
flutter命令.png

步骤1:


image.png

步骤2:


image.png

步骤1:


image.png

步骤2:


image.png
名称 对应类 说明
create CreateCommand 创建新的Flutter项目
build BuildCommand Flutter构建命令
install InstallCommand 安装Flutter应用到已连接设备
run RunCommand 运行Flutter应用于已连接设备
packages PackagesCommand 管理Flutter包的命令
devices DevicesCommand 列出所有已连接的设备
emulators EmulatorsCommand 列出,启动,创建模拟器
attach AttachCommand 附加到正在运行的应用程序
trace TraceCommand 开始和停止跟踪正在运行的Flutter应用程序
logs LogsCommand 显示Flutter应用运行中的log
doctor DoctorCommand 显示关于已安装工具的信息
upgrade UpgradeCommand 升级Flutter
clean CleanCommand 删除build/和.dart_tool/ 目录
analyze AnalyzeCommand 分析项目Dart代码
format FormatCommand 格式化一个或多个dart文件
config ConfigCommand 配置Flutter settings
drive DriveCommand 为当前项目运行Flutter Driver测试
test TestCommand 为当前项目运行Flutter 单元测试
上一篇 下一篇

猜你喜欢

热点阅读