Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Future<void> loadSvgImage({required bool back, required String svgImage}) async {
String generalString = await rootBundle.loadString(svgImage);
XmlDocument document = XmlDocument.parse(generalString);
final paths = document.findAllElements('path');
paths.forEach((element) {
String partName = element.getAttribute('id').toString();
String partPath = element.getAttribute('d').toString();
if (!partName.contains('path')) {
GeneralBodyPart part = GeneralBodyPart(name: partName, path: partPath);
if (back) {
generalBackBodyParts.add(part);
} else {
generalFrontBodyParts.add(part);
}
}
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment