probe static method
Probes for:
- available storage implementations based on supported web APIs.
- APIs not currently supported by the browser.
- existing drift databases in the current browsing context.
This information can be used to control whether to open a drift database, or whether the current browser is unsuitable for the persistence requirements of your app. For most apps, using open directly is easier. It calls probe internally and uses the best storage implementation available.
The databaseName
option is not strictly required. But drift can't list
databases stored in IndexedDb, they are not part of
WasmProbeResult.existingDatabases by default. This is because drift
databases can't be distinguished from other IndexedDb databases without
opening them, which might disturb the running operation of them. When a
databaseName
is passed, drift will explicitly probe whether a database
with that name exists in IndexedDb and whether it is a drift database.
Drift is always able to list databases stored in OPFS, regardless of
whether databaseName
is passed or not.
Note that this method is only fully supported when using the drift worker
shipped with the drift 2.11 release. Older workers are only supported when
databaseName
is non-null.
Implementation
static Future<WasmProbeResult> probe({
required Uri sqlite3Uri,
required Uri driftWorkerUri,
String? databaseName,
}) async {
return await WasmDatabaseOpener(sqlite3Uri, driftWorkerUri, databaseName)
.probe();
}