code_builder icon indicating copy to clipboard operation
code_builder copied to clipboard

Allow defining an EnumValue with named parameters

Open SamJakob opened this issue 2 years ago • 0 comments

It doesn't appear possible to do this with code_builder and the functionality within Flutter to do this is relatively new. In terms of an example:

//...
return EnumValue((builder) {
  b.name = 'example';
  b.arguments.add(literal("Some argument"));

  b.arguments.add(literal("Some other argument"), name: "test");
  // or alternatively, b.namedArguments could be added to EnumValueBuilder.
});
//...

Where this might result in the following:

// ...

  example("Some argument", test: "Some other argument"),

// ...

SamJakob avatar Feb 12 '23 20:02 SamJakob