updateKey method

Future<void> updateKey({
  1. required String name,
  2. String? metadata,
  3. Map<String, dynamic>? tags,
  4. int? expiryMs,
})

Updates details of a key in the store.

Throws an AskarSessionException if the session is closed.

Implementation

Future<void> updateKey({
  required String name,
  String? metadata,
  Map<String, dynamic>? tags,
  int? expiryMs,
}) async {
  _throwOnNullHandle('Cannot update a key with a closed session');

  try {
    final callbackResult = await askarSessionUpdateKey(
      handle!,
      name,
      metadata: metadata,
      tags: tags,
      expiryMs: expiryMs,
    );

    callbackResult.throwOnError();
  } catch (e) {
    throw AskarSessionException('Failed to update key on session: $e');
  }
}