parser.dart 471 B

12345678910111213141516
  1. import 'dart:async';
  2. import 'package:xml/xml_events.dart' as xml show parseEvents;
  3. import 'src/svg/parser_state.dart';
  4. import 'src/vector_drawable.dart';
  5. /// Parses SVG data into a [DrawableRoot].
  6. class SvgParser {
  7. /// Parses SVG from a string to a [DrawableRoot].
  8. ///
  9. /// The [key] parameter is used for debugging purposes.
  10. Future<DrawableRoot> parse(String str, {String key}) async {
  11. return await SvgParserState(xml.parseEvents(str), key).parse();
  12. }
  13. }