sdbExportDatabaseLines function

Future<List<Object>> sdbExportDatabaseLines(
  1. Database db
)

export a database in a sdb export format

Implementation

Future<List<Object>> sdbExportDatabaseLines(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.exportDatabaseLines(sdbDatabase!);
  } else {
    // otherwise copy to a memory one
    db = await copyDatabase(db, idbFactoryMemory, _tempExportPath);
    sdbDatabase = (idbFactoryMemory as IdbFactorySembast).getSdbDatabase(db);
    var export = await sembast.exportDatabaseLines(sdbDatabase!);
    db.close();
    return export;
  }
}