List<String> annotationsFromMetadata(List md)

Returns annotations from a given metadata set, with escaping. md is a dynamic parameter since ElementAnnotation and Annotation have no common class for calling toSource() and element.

Source

List<String> annotationsFromMetadata(List<dynamic> md) {
  if (md == null) md = new List<dynamic>();
  return md.map((dynamic a) {
    String annotation = (const HtmlEscape()).convert(a.toSource());
    var me = package.findCanonicalModelElementFor(a.element.enclosingElement);
    if (me != null)
      annotation = annotation.replaceFirst(me.name, me.linkedName);
    return annotation;
  }).toList(growable: false);
}