dispose static method

Future<void> dispose()

Closes the active vector store (releasing its native handle — qdrant-edge shard / sqlite connection) and then resets the DI singleton.

Use this instead of reset when a configured vector store is live and you intend to re-initialize afterwards (e.g. swapping RAG backends). Safe to call when uninitialized (no-op). The installed embedder + active inference model survive — they live in the platform plugin instance + prefs, not the DI singleton.

Implementation

static Future<void> dispose() async {
  try {
    await ServiceRegistry.instance.dispose();
  } on StateError {
    // Not initialized — nothing to dispose.
  }
  ServiceRegistry.reset();
}