openReadOnlyFile function
Opens path for reading. A pending -wal or hot -journal is recovered
in memory. The file and its sidecars are not modified. A shared SQLite
lock is held until the database is closed.
Implementation
Future<SqliteDatabase> openReadOnlyFile(String path,
{int maxImageBytes = 64 * 1024 * 1024}) async {
final storage =
await OfficialFileStorage.open(path, maxImageBytes: maxImageBytes);
try {
return await SqliteDatabase.openReadOnly(storage);
} catch (_) {
await storage.close();
rethrow;
}
}