fromSvgAsset static method
Future<ScalableImage>
fromSvgAsset(
- AssetBundle b,
- String key, {
- bool compact = false,
- bool bigFloats = false,
- @Deprecated("[warn] has been superseded by [warnF].") bool warn = true,
- void warnF()?,
- Color? currentColor,
Load a string asset containing an SVG
from b
and parse it into 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 SVG asset contains
unrecognized tags and/or tag attributes. If it is null, the default
behavior is to print warnings.
See also ScalableImage.currentColor.
Implementation
static Future<ScalableImage> fromSvgAsset(AssetBundle b, String key,
{bool compact = false,
bool bigFloats = false,
@Deprecated("[warn] has been superseded by [warnF].") bool warn = true,
void Function(String)? warnF,
Color? currentColor}) async {
final warnArg = warnF ?? (warn ? defaultWarn : nullWarn);
final String src = await b.loadString(key, cache: false);
return fromSvgString(src,
compact: compact,
bigFloats: bigFloats,
warnF: warnArg,
currentColor: currentColor);
}