copyDatabase function

Future<Database> copyDatabase(
  1. Database srcDatabase,
  2. IdbFactory dstFactory,
  3. String dstDbName
)

Copy a database content to a new database.

Implementation

Future<Database> copyDatabase(
    Database srcDatabase, IdbFactory dstFactory, String dstDbName) async {
  final dstDatabase = await copySchema(srcDatabase, dstFactory, dstDbName);
  for (final storeName in srcDatabase.objectStoreNames) {
    await copyStore(srcDatabase, storeName, dstDatabase, storeName);
  }
  return dstDatabase;
}