fromAvdString static method

ScalableImage fromAvdString(
  1. String src, {
  2. bool compact = false,
  3. bool bigFloats = false,
  4. @Deprecated("[warn] has been superseded by [warnF].") bool warn = true,
  5. void warnF(
    1. String
    )?,
})

Parse an Android Vector Drawable XML string to a scalable image.

If compact is true, the internal representation will occupy significantly less memory, at the expense of rendering time. See toDag for a discussion of the two representations.

If bigFloats is true, the compact representation will use 8 byte double-precision float values, rather than 4 byte single-precision values.

If warnF is non-null, it will be called if the AVD asset contains unrecognized tags and/or tag attributes. If it is null, the default behavior is to print warnings.

Implementation

static ScalableImage fromAvdString(
  String src, {
  bool compact = false,
  bool bigFloats = false,
  @Deprecated("[warn] has been superseded by [warnF].") bool warn = true,
  void Function(String)? warnF,
}) {
  final warnArg = warnF ?? (warn ? defaultWarn : nullWarn);
  if (compact) {
    final b = SICompactBuilder(warn: warnArg, bigFloats: bigFloats);
    StringAvdParser(src, b).parse();
    return b.si;
  } else {
    final b = SIDagBuilder(warn: warnArg);
    StringAvdParser(src, b).parse();
    return b.si;
  }
}