sharedDatabase property

AuthDatabase sharedDatabase
final

A common database throughout the application.

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

Implementation

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