initFromFile method
Load using JMdict XML file
xmlFile
references to existing, accessible JMdict file (extracted from
JMDict.gz, a valid XML file)
Enabling forceUpdate
will append/update into existing local Database
if exists
Implementation
Future<void> initFromFile({required File xmlFile, bool forceUpdate = false,}) async {
if (_isInitialized || _isLoading) {
_warnAlreadyInitialized();
return;
}
_isLoading = true;
final store = await openStore();
final box = store.box<JMDictEntryImpl>();
if (await xmlFile.exists()) {
if (box.isEmpty() || !box.isEmpty() && forceUpdate) {
await _loader.load(xmlFile, store,);
}
} else {
_isInitialized = false;
_isLoading = false;
return;
}
_store = store;
_isInitialized = true;
_isLoading = false;
}