diff --git a/lib/services/bible_xml_parser.dart b/lib/services/bible_xml_parser.dart index a5e7ab2..e5607bf 100644 --- a/lib/services/bible_xml_parser.dart +++ b/lib/services/bible_xml_parser.dart @@ -1,7 +1,13 @@ import 'package:flutter/services.dart' show rootBundle; +import 'package:flutter/foundation.dart'; import 'package:xml/xml.dart'; import '../models/scripture.dart'; // Assuming Scripture model might need BibleTranslation +// Helper for background XML parsing +XmlDocument parseXmlString(String xml) { + return XmlDocument.parse(xml); +} + class BibleXmlParser { // Map of common Bible book names to their standard abbreviations or keys used in XML // This will help in matching references like "Matthew 11:28" to XML structure. @@ -56,7 +62,7 @@ class BibleXmlParser { print('Loading and parsing XML asset: $assetPath'); // Debug log final String xmlString = await rootBundle.loadString(assetPath); - final document = XmlDocument.parse(xmlString); + final document = await compute(parseXmlString, xmlString); _xmlCache[assetPath] = document; return document; }