fromAvdString method

DrawableRoot fromAvdString(
  1. String rawSvg,
  2. String key
)

Creates a DrawableRoot from a string of Android Vector Drawable data.

Implementation

DrawableRoot fromAvdString(String rawSvg, String key) {
  final XmlElement svg = XmlDocument.parse(rawSvg).rootElement;
  final DrawableViewport viewBox = parseViewBox(svg.attributes);
  final List<Drawable> children = svg.children
      .whereType<XmlElement>()
      .map((XmlElement child) => parseAvdElement(child, viewBox.viewBoxRect))
      .toList();
  // todo : style on root
  return DrawableRoot(getAttribute(svg.attributes, 'id', def: ''), viewBox,
      children, DrawableDefinitionServer(), null);
}