How to get Annotation metadata in Dart?

自闭症网瘾萝莉.ら 提交于 2020-03-25 18:55:25

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!