fromAvdHttpUrl static method
Parse an Android Vector Drawable XML document from a URL to a scalable image. Usage:
final si = await ScalableImage.fromAvdHttpUrl(
Uri.parse('https://jovial.com/images/jupiter.avd'));
url
is an http:, https: or data: Uri
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.
httpHeaders
will be added to the HTTP GET request.
defaultEncoding
specifies the character encoding to use if the
content-type header of the HTTP response does not indicate an encoding.
RVC 2916 specifies latin1 for HTTP, but current browser practice defaults
to UTF8.
See also ScalableImage.currentColor.
Implementation
static Future<ScalableImage> fromAvdHttpUrl(
Uri url, {
bool compact = false,
bool bigFloats = false,
@Deprecated("[warn] has been superseded by [warnF].") bool warn = true,
void Function(String)? warnF,
Encoding defaultEncoding = utf8,
Map<String, String>? httpHeaders,
}) async {
final warnArg = warnF ?? (warn ? defaultWarn : nullWarn);
return fromAvdString(await _getContent(url, defaultEncoding, httpHeaders),
compact: compact, bigFloats: bigFloats, warnF: warnArg);
}