Recipes

Close the data graph safely

Stop producers before consumers and keep shared DataSource ownership in the Composition Root.

v0.1.0-dev.1Advancedark_data_layer

Close the data graph safely

dart
await binding.close();
await useCase.close();
await repository.close();
await remoteSource.close();
await database.close();

The outer Composition Root owns shared sources. Override closeRepository() only for subscriptions or resources created by that Repository itself. Repeated repository.close() calls return the same Future and never repeat cleanup.

ARKTELOS

Purpose-built engineering systems for software that has to hold.