Learn

DataSource contracts

Define narrow source contracts and resolve exactly one implementation by assignable type.

v0.1.0-dev.1Intermediateark_data_layer

DataSource contracts

Prefer one contract per technical responsibility:

dart
abstract interface class CatalogRemoteDataSource implements DataSource {
  Future<CatalogResponseDto> fetchCatalog();
}

abstract interface class CatalogCacheDataSource implements DataSource {
  Future<CatalogCacheDto?> readCatalog();
  Future<void> writeCatalog(CatalogCacheDto data);
}

DataSourceContainer copies the supplied iterable and resolves by Dart type assignability.

MatchesResult
0DataSourceNotFoundException
1the matching object
2 or moreAmbiguousDataSourceException

Strict ambiguity handling prevents registration order from silently selecting storage behavior. If remote and local sources have different responsibilities, give them different interfaces instead of a runtime string key.

ARKTELOS

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