close method

  1. @override
Future<void> close()
override

Close all underlying resources. Idempotent.

Implementation

@override
Future<void> close() async {
  if (_closed) return;
  _closed = true;
  // Order is the inverse of [HiveAtPersistenceFactory.initialize]:
  // close the keystore first (so any in-flight expiry task
  // observes a closed box), then logs and notifications.
  await keyValueStore.close();
  final commitLog = keyValueStore.commitLog;
  if (commitLog is HiveAtCommitLog) {
    await commitLog.close();
  }
  await accessLog?.close();
  await notificationKeystore?.close();
}