sharedDatabase property

LoggerDatabase sharedDatabase
final

A common database throughout the application.

アプリ内全体での共通のデータベース。

Implementation

static final LoggerDatabase sharedDatabase = LoggerDatabase(
  onInitialize: (database) async {
    try {
      database._data = await LoggerExporter.import(
        "${LoggerExporter.documentDirectory}/${_kLocalDatabaseId.toSHA1()}",
      );
    } catch (e) {
      database._data = {};
    }
  },
  onSaved: (database) async {
    await LoggerExporter.export(
      "${LoggerExporter.documentDirectory}/${_kLocalDatabaseId.toSHA1()}",
      database._data,
    );
  },
);