Basically I required to assign version and my local dependencies URL as user defined variable and assign the same in the path or wherever I wish to
Example like below
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
In Android I can achieve as below
dagger_version=2.8
"com.google.dagger:dagger:${dagger_version}"
Every Flutter project includes a pubspec. yaml file, often referred to as the pubspec. A basic pubspec is generated when you create a new Flutter project. It's located at the top of the project tree and contains metadata about the project that the Dart and Flutter tooling needs to know.
Is it possible to import another YAML file into pubspec.yaml
the answer to the above is No, it is not possible because pubspec.yaml
does not support imports.
Now for your main question : you can use YAML Anchors and Aliases for example :
# 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 because I'm not sure of the syntax but this should help with what you are looking for
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With