假设我们有像这样的 pubspec.yaml:
name: myApp
version: x.y.z
我可以在运行时在主函数中获得高于 x.y.z 的版本吗?
最佳答案
目前没有通用的方法。参见 https://github.com/google/grinder.dart/blob/19a6d13866de8f4a3b295074a3487eaa77b7a2f8/lib/src/cli.dart#L17了解它是如何在 Grinder 包中完成的。有计划对此进行改进。例如,参见此讨论 https://groups.google.com/a/dartlang.org/forum/m/#!topic/core-dev/8WrVpjD6tt8
关于dart - 是否可以在运行时获取 pubspec.yaml 版本?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30341050/