avdPictureStringDecoder method

Future<PictureInfo> avdPictureStringDecoder(
  1. String raw,
  2. bool allowDrawingOutsideOfViewBox,
  3. ColorFilter? colorFilter,
  4. String key,
)

Decodes an Android Vector Drawable from a String to a PictureInfo object.

Implementation

Future<PictureInfo> avdPictureStringDecoder(
  String raw,
  bool allowDrawingOutsideOfViewBox,
  ColorFilter? colorFilter,
  String key,
) async {
  final DrawableRoot avdRoot = fromAvdString(raw, key);
  final Picture pic = avdRoot.toPicture(
    clipToViewBox: allowDrawingOutsideOfViewBox == true ? false : true,
    colorFilter: colorFilter,
  );
  return PictureInfo(
    picture: pic,
    viewport: avdRoot.viewport.viewBoxRect,
    size: avdRoot.viewport.size,
    compatibilityTester: const CacheCompatibilityTester(),
  );
}