RepositoryConnectivityImpl class

Default repository that maps raw payloads to domain (ConnectivityModel) and enforces error semantics using an ErrorMapper.

Error contract

  • fromPayload(...) detects business errors encoded in payloads and returns Left(ErrorItem).
  • If mapping fails (fromJson throws), the repository converts it into Left(ErrorItem) via fromException(...).
  • Repository never throws; it always returns Either<ErrorItem, ConnectivityModel>.

Example

final repo = RepositoryConnectivityImpl(gateway, errorMapper: DefaultErrorMapper());
final res = await repo.snapshot();
res.fold(
  (err) => print('Repo error: ${err.code}'),
  (model) => print('Speed: ${model.internetSpeed}'),
);
Inheritance

Constructors

RepositoryConnectivityImpl(GatewayConnectivity gateway, {ErrorMapper? errorMapper})

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

checkSpeed() Future<Either<ErrorItem, ConnectivityModel>>
override
checkType() Future<Either<ErrorItem, ConnectivityModel>>
override
current() ConnectivityModel
override
flatMap(Either<ErrorItem, Map<String, dynamic>> either) Either<ErrorItem, ConnectivityModel>
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
snapshot() Future<Either<ErrorItem, ConnectivityModel>>
override
toString() String
A string representation of this object.
inherited
watch() Stream<Either<ErrorItem, ConnectivityModel>>
override

Operators

operator ==(Object other) bool
The equality operator.
inherited