基本上我需要将版本和我的本地依赖项 URL 分配为用户定义的变量,并在路径或我希望的任何地方分配相同的内容
像下面这样的例子
mydependancyPath : D:\mylocalDependancy
commonUtils:
path: mydependancyPath
Run Code Online (Sandbox Code Playgroud)
1.请让我知道如何实现上述目标
2.是否可以将另一个YAML文件导入pubspec.yaml
在Android中我可以实现如下
dagger_version=2.8
"com.google.dagger:dagger:${dagger_version}"
Run Code Online (Sandbox Code Playgroud)
Asm*_*oun 10
是否可以将另一个 YAML 文件导入 pubspec.yaml
上面的答案是否定的,这是不可能的,因为pubspec.yaml不支持导入。
现在对于您的主要问题:您可以使用YAML 锚点和别名,例如:
# this line has the path , and stored in varName for future use we use *varName
mydependancyPath : &varNam D:\mylocalDependancy
# this line has the version number , so we can use *vers as a key that holds the value 2.8
myversion : &vers 2.8
#!join is to concatinate
path : !join [*varName, *vers]
Run Code Online (Sandbox Code Playgroud)
这是一个更详细的资源,因为我不确定语法,但这应该对您要查找的内容有所帮助
| 归档时间: |
|
| 查看次数: |
541 次 |
| 最近记录: |