How to create our own metadata in Dart?

后端 未结 2 1952
无人及你
无人及你 2021-01-01 19:29

I want to create some own metadata for my dart codem, e.g. @table, @column, but I can\'t find any useful documents about it.

But I do found there are some special me

2条回答
  •  自闭症患者
    2021-01-01 20:08

    • This is an interesting blog post about Dart annotations
      http://japhr.blogspot.co.at/2013/01/i-love-dart-annotations.html

    • Here the meta data part of the Dart language specification
      https://www.dartlang.org/docs/spec/latest/dart-language-specification.html#h.d0rowtffuudf

    Metadata consists of a series of annotations, each of which begin with the character @, followed a constant expression that starts with an identifier.

    So you can use a class with a const constructor as annotation.

    • Dart Up and Running https://www.dartlang.org/docs/dart-up-and-running/contents/ch02.html#ch02-metadata

提交回复
热议问题