Learn

Repository and domain interfaces

Separate the reusable Repository base from the business-facing contract owned by the domain.

v0.1.0-dev.1Intermediateark_data_layer

Repository and domain interfaces

The domain interface does not need to extend Repository<Data>:

dart
abstract interface class CatalogRepository {
  CatalogData get data;
  Stream<CatalogData> get stream;
  Future<void> synchronize();
}

The Data-layer implementation supplies both relationships:

dart
final class CatalogRepositoryImpl extends Repository<CatalogData>
    implements CatalogRepository {
  // Mapping and source-coordination policy.
}

Repository<Data> retains one current value. setData replaces it; updateData performs a synchronous transformation. Every explicit commit is observable, even when the new value compares equal to the previous value.

Use immutable business snapshots where possible. The base cannot prevent a mutable object from changing through its own API after publication.

ARKTELOS

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