dartanalyzerdart-analyzer

how to check if function parameter is optional using anzlyzer package?


how to check if function parameter is optional using anzlyzer package?

For example:

myFunction(param1, {param2});

I would like to know that param1 is required and param2 is optional


Solution

  • Parameters, if I remember correctly, have a kind getter, which is an instance of ParameterKind, which can be REQUIRED, NAMED or POSITIONAL (also optional).