Recipes

Resolve sources without ambiguity

Build an immutable DataSourceContainer and make missing or duplicate contracts fail explicitly.

v0.1.0-dev.1Intermediateark_data_layer

Resolve sources without ambiguity

dart
final sources = DataSourceContainer(<DataSource>[
  HttpCatalogDataSource(client),
  SqliteCatalogCache(database),
]);

final remote = sources.get<CatalogRemoteDataSource>();
final cache = sources.maybeGet<CatalogCacheDataSource>();

Use get for a required contract and maybeGet for an optional contract. Both reject two assignable objects. Do not resolve multiple implementations by relying on list order; split materially different responsibilities into separate interfaces.

ARKTELOS

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