initHive method
dynamic
initHive(
{ - String? path,
})
Implementation
initHive({String? path}) async {
if (!completer.isCompleted) {
if (path != null && !UtilsPlatform.isWeb) {
Hive.init(path);
} else {
if (UtilsPlatform.isDesktop) {
Hive.init("${Directory.current.path}/data/.hive_db");
} else if (UtilsPlatform.isMobile) {
var dir = await getApplicationDocumentsDirectory();
Hive.init(dir.path);
}
try {
adapters.forEach((element) {
Hive.registerAdapter(element);
});
} catch (e) {
print(e);
}
completer.complete(true);
}
}
return true;
}