Search code examples
flutterdartyamlpubspec

Is there any way to reference names within pubspec.yaml?


Is there any way to reference a predefined name in pubspec.yaml?

I am trying to reference the "name" key's value in a structure used by a plugin

name: tpoly
description: A new Flutter application.

# [...]

flutter_launcher_name:
  name: *name

At the end the plugin should receive (basically the value should get substituted),

flutter_launcher_name:
  name: tpoly

Solution

  • First declare the variable using &. Here, foo, for example:

    name: &foo tpoly
    

    To refer, use *.

    flutter_launcher_name:
      name: *foo