基本上我需要将版本和我的本地依赖项 URL 分配为用户定义的变量,并在路径或我希望的任何地方分配相同的内容
像下面这样的例子
mydependancyPath : D:\mylocalDependancy
commonUtils:
path: mydependancyPath
1.Please let me know how can I achieve as like above
2.Is it possible to import another YAML file into pubspec.yaml
在Android中我可以实现如下
dagger_version=2.8
"com.google.dagger:dagger:${dagger_version}"
最佳答案
Is it possible to import another YAML file into pubspec.yaml
pubspec.yaml
不支持进口。您可以使用 YAML Anchors and Aliases例如 :
# 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]
here is a more detailed resource因为我不确定语法,但这应该对您要查找的内容有所帮助
关于flutter - 我如何在 pubspec.yaml 中添加用户定义的变量以进行 flutter ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64803659/