问题
I am using package:analyzer package. I have extended SimpleElementVisitor
to visit all the fields of the class. visitFieldElement(FieldElement element)
is providing all the fields data type and fields name. But some of the fields are annotated with custom annotation. How I can read the metadata of that annotation?
回答1:
From the Element
instance (A FieldElement
in the example) you can use the metadata field to read out annotations.
来源:https://stackoverflow.com/questions/56388967/how-to-get-annotation-metadata-in-dart