WriteDocUseCase<T extends Model> class
Writes (creates/updates) a single entity at WriteParams.docId.
Returns:
Right(T)with the authoritative value returned by the repository.Left(ErrorItem)on failure.
Example:
void main() async {
final RepositoryWsDatabase<UserModel> repo = MyRepo<UserModel>();
final res = await WriteDocUseCase<UserModel>(repo)
.call(WriteParams<UserModel>('u1', defaultUser));
res.fold(
(e) => print('write error: ${e.code}'),
(u) => print('saved: ${u.id}'),
);
}
- Implemented types
-
- UseCase<
Either< ErrorItem, T> , WriteParams<T> >
- UseCase<
Constructors
-
WriteDocUseCase(RepositoryWsDatabase<
T> _repo)
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
-
call(
WriteParams< T> params) → Future<Either< ErrorItem, T> > -
override
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited