sdbExportDatabase function
export a database in a sdb export format
Implementation
Future<Map<String, Object?>> sdbExportDatabase(Database db) async {
var srcIdbFactory = db.factory;
sembast.Database? sdbDatabase;
// if already a sembast database use it
// if (false) {
if (srcIdbFactory is IdbFactorySembast) {
sdbDatabase = srcIdbFactory.getSdbDatabase(db);
return sembast.exportDatabase(sdbDatabase!);
} else {
// otherwise copy to a memory one
db = await copyDatabase(db, idbFactoryMemory, _tempExportPath);
sdbDatabase = (idbFactoryMemory as IdbFactorySembast).getSdbDatabase(db);
var export = await sembast.exportDatabase(sdbDatabase!);
db.close();
return export;
}
}