dvLocalAnalyticsDatabase function
Opens this application's device-local analytics database.
A SQLite file in directory, or where dvAnalyticsDirectoryFor says for
this platform, on platforms with dart:io. In a browser the consent records
and the install id are kept in IndexedDB and the event outbox in memory.
It is held in memory instead, writing nothing, when the platform gives no
directory that survives a restart, and under flutter test, where an
application's widget tests would otherwise write into the developer's own
data directory. A database in memory loses the choice at exit, so the
person is asked again: the direction that records no consent nobody gave.
environment and os default to the running process's; appId names
the file and must be a plain name.
Implementation
Future<DVDatabaseAdapter> dvLocalAnalyticsDatabase(
String appId, {
String? directory,
String? os,
Map<String, String>? environment,
String? androidStateDirectory,
}) {
if (!RegExp(r'^[A-Za-z0-9_.-]+$').hasMatch(appId) ||
appId == '.' ||
appId == '..') {
throw ArgumentError.value(appId, 'appId', 'must be a plain name');
}
return platform.dvOpenLocalAnalyticsDatabase(
appId,
directory: directory,
os: os,
environment: environment,
androidStateDirectory: androidStateDirectory,
);
}