dvLocalOfflineDatabase function

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

Opens this device's store for appId's offline data models.

A SQLite file in directory, or in the application's data directory for this platform, where there is dart:io; IndexedDB in a browser; memory under flutter test, where an application's widget tests would otherwise write into the developer's own data directory, and wherever the platform gives nowhere that survives a restart. A memory-backed store reports itself (DV-OFFLINE-001).

DARTVEL_OFFLINE_DIR in environment names the directory everywhere.

Implementation

Future<DVDatabaseAdapter> dvLocalOfflineDatabase(
  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.dvOpenLocalOfflineDatabase(
    appId,
    directory: directory,
    os: os,
    environment: environment,
    androidStateDirectory: androidStateDirectory,
  );
}