flutter_svg 0.8.1

This is a Dart-native rendering library. Issues/PRs will be raised in Flutter
and flutter/engine as necessary for features that are not good candidates for
Dart implementations (especially if they're impossible to implement without
engine support). However, not everything that Skia can easily do needs to be
done by Skia; for example, the Path parsing logic here isn't much slower than
doing it in native, and Skia isn't always doing low level GPU accelerated work
where you might think it is (e.g. Dash Paths).

All of the SVGs in the assets/ folder (except the text related one(s)) now
have corresponding PNGs in the golden/ folder that were rendered using
flutter test tool/gen_golden.dart and compared against their rendering output
in Chrome. Automated tests will continue to compare these to ensure code changes
do not break known-good renderings.

The default placeholder is an empty box (LimitedBox) - although if a height
or width is specified on the SvgPicture, a SizedBox will be used instead
(which ensures better layout experience). There is currently no way to show an
Error visually, however errors will get properly logged to the console in debug
mode.

You can also specify a placeholder widget. The placeholder will display during
parsing/loading (normally only relevant for network access).

If you'd like to render the SVG to some other canvas, you can do something like:

import 'package:flutter_svg/flutter_svg.dart';
final String rawSvg = '''<svg viewBox="...">...</svg>''';
final DrawableRoot svgRoot = await svg.fromSvgString(rawSvg, rawSvg);
// If you only want the final Picture output, just use
final Picture picture = svgRoot.toPicture();
// Otherwise, if you want to draw it to a canvas:
// Optional, but probably normally desirable: scale the canvas dimensions to
// the SVG's viewbox
svgRoot.scaleCanvasToViewBox(canvas);
// Optional, but probably normally desireable: ensure the SVG isn't rendered
// outside of the viewbox bounds
svgRoot.clipCanvasToViewBox(canvas);
svgRoot.draw(canvas, size);

The SvgPicture helps to automate this logic, and it provides some convenience
wrappers for getting assets from multiple sources and caching the resultant
Picture. It does not render the data to an Image at any point; you
certainly can do that in Flutter, but you then lose some of the benefit of
having a vector format to begin with.

While I'm making every effort to avoid needlessly changing the API, it's not
guarnateed to be stable yet (hence the pre-1.0.0 version). To date, the biggest
change is deprecating the SvgImage widgets in favor of SvgPicture - it
became very confusing to maintain that name, as Pictures are the underlying
mechanism for rendering rather than Images.

Support for minimal CSS/styles? See also svgcleaner
(partial style attribute mostly supported).

Markers.

Filters/effects (will require upstream engine changes, but doable).

Android Vector Drawable support beyond PoC - I'm willing to put more time into
this if there's actually demand, but it doesn't come up often.

The XML parsing implementation is heavy for what this really needs. I've made
efforts to keep the API forward-reading-only compatible to eventually be able
to use a SAX/XMLReader streaming style parser.

SVGs in /assets/simple are pulled from trivial examples or generated to test
basic functionality - some of them come directly from the SVG 1.1 spec. Some
have also come or been adapted from issues raised in this repository.

By default, SvgPicture.asset will now cache the asset. We already cached the
final picture, but the caching included any color filtering provided on the
image. This is problematic if the color is animated. See
https://github.com/dnfield/flutter_svg/issues/33

Previously, width and height were treated as synonyms for the width and
height of the viewBox. This is not correct, and resulted in meaningful
rendering errors in some scenarios compared to Chrome. Fixing this makes the
parser more conformant to the spec, but may make your SVGs look
significantly different if they specify width or height. If you want the
old behavior, you'll have to update your SVGs to not specify width and
height (only specify viewBox).

Use MediaQuery.of(context).devicePixelRatio if available before defaulting
to window.devicePixelRatio in places that need awareness of
devicePixelRatios.

Support for <use>, <symbol>, and shape/group elements in <defs>. There
are some limitations to this currently,

BREAKING CHANGE: SvgImage, AvdImage, and VectorDrawableImage have been
deprecated. They relied on methods that are less efficient than those now
surfaced in SvgPicture.

BREAKING CHANGE: Size is no longer passed to SvgPicture - its size is
determined by parent size.

BREAKING CHANGE: clipToViewBox is now called allowDrawingOutsideViewBox.
It defaults to false. It should not ordinarily be set to true, as it can allow
unexpected memory usage if your vector graphic tries to draw far outside of
the viewBox bounds.

BREAKING CHANGE: SvgPicture does not support custom ErrorWidgetBuilders at
this point in time. However, errors will be properly logged to the console.
This is a result of improvements in the loading/caching of drawings.