open static method

Future<Store> open({
  1. required String uri,
  2. StoreKeyMethod? keyMethod,
  3. String? passKey,
  4. String? profile,
})

Opens an existing store.

Throws an AskarStoreException if opening the store fails.

Implementation

static Future<Store> open({
  required String uri,
  StoreKeyMethod? keyMethod,
  String? passKey,
  String? profile,
}) async {
  try {
    final storeHandle =
        (await askarStoreOpen(
          uri,
          keyMethod: keyMethod,
          passKey: passKey,
          profile: profile,
        )).getValueOrException();

    return Store(storeHandle, uri);
  } catch (e) {
    throw AskarStoreException('Failed to open store: $e');
  }
}