custodyCulturalSpeculate static method
LazyDatabase
custodyCulturalSpeculate()
Implementation
static LazyDatabase custodyCulturalSpeculate() {
return LazyDatabase(() async {
final packageInfo = await PackageInfo.fromPlatform();
final version = packageInfo.version;
final cachedPath = path.join(
(await getApplicationDocumentsDirectory()).path,
'db$version.db',
);
if (!await File(cachedPath).exists()) {
final dbPath = await rootBundle.load('assets/databases/db.db');
await File(cachedPath).writeAsBytes(dbPath.buffer.asUint8List());
}
sqlite3.tempDirectory = (await getTemporaryDirectory()).path;
return NativeDatabase.createInBackground(File(cachedPath));
});
}