dvLocalAnalyticsDatabase function

Future<DVDatabaseAdapter> dvLocalAnalyticsDatabase(
  1. String appId, {
  2. String? directory,
  3. String? os,
  4. Map<String, String>? environment,
  5. String? androidStateDirectory,
})

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. It is held in memory instead, writing nothing, on the web (no SQLite), 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,
  );
}