parse method

Future<DrawableRoot> parse(
  1. String str, {
  2. SvgTheme? theme,
  3. String? key,
  4. bool warningsAsErrors = false,
})

Parses SVG from a string to a DrawableRoot with the provided theme.

The key parameter is used for debugging purposes.

By default SVG parsing will only log warnings when detecting unsupported elements in an SVG. If warningsAsErrors is true the function will throw with an error instead. You might want to set this to true for test and to false at runtime. Defaults to false.

Implementation

Future<DrawableRoot> parse(
  String str, {
  SvgTheme? theme,
  String? key,
  bool warningsAsErrors = false,
}) async {
  final SvgParserState state =
      SvgParserState(xml.parseEvents(str), theme, key, warningsAsErrors);
  return await state.parse();
}