how can i add user defined variable in pubspec.yaml for flutter? how can i add user defined variable in pubspec.yaml for flutter? dart dart

how can i add user defined variable in pubspec.yaml for flutter?


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 *varNamemydependancyPath : &varNam D:\mylocalDependancy# this line has the version number , so we can use *vers as a key that holds the value 2.8myversion : &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