dispose method

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

Release the resources this backend itself constructed (database connections, HTTP clients). Idempotent — safe to call twice. Every method except dispose throws StateError afterwards.

Ownership rule: a backend disposes ONLY what it created. Decorators (EncryptedBackend, ChunkedBackend) never dispose the backend they wrap — whoever constructed the inner backend disposes it. Cellar.close() follows the same rule: it disposes the backends it built, and leaves Cellar.withBackends-provided ones to the caller.

Implementation

@override
Future<void> dispose() async {
  // Ownership rule: the backing backend is caller-provided, so its
  // creator disposes it — this layer only arms its own guard.
  markDisposed();
}