init method

Future<void> init()

Implementation

Future<void> init() async {
  final storeNames = await _getAll();

  // 1. The resolver is a special store that is not indexed along-side the other data stores.
  // 2. The separate plaintext vs encrypted data stores for the same store name do not need to be indexed
  //    separately and are represented by a single [DualDataStore].
  final indexNames = storeNames
      .where((name) => name != DataStoreResolver.name)
      .map((name) =>
          name.replaceAll('.${DataStoreEncrypter.encryptedName}', ''))
      .toSet();

  for (final name in indexNames) {
    index[name] = DualDataStore(name, factory: factory, encrypter: encrypter);
  }

  await Future.wait([
    resolver.hydrate(),
    encrypter.init(),
  ]);
}