CompletableUseCase<Params> class abstract

A special type of UseCase that does not return any value. This UseCase only performs a task and reports either success or failure. A good candidate for such a UseCase would be logout or login.

    // A `UseCase` for logging out a `User`
    class LogoutUseCase extends CompletableUseCase<void> {

      AuthenticationRepository _authenticationRepository;///
      LogoutUseCase(this._authenticationRepository);

      @override
      Future<Stream<User>> buildUseCaseStream(void ignore) async {
        final StreamController<User> controller = StreamController();
        try {
          await _authenticationRepository.logout();
          controller.close();
        } catch (e) {
          controller.addError(e);
        }
        return Stream(controller.stream);
      }
    }

Inheritance

Constructors

CompletableUseCase()

Properties

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

Methods

buildUseCaseStream(Params? params) Future<Stream<void>>
Builds the Stream to be subscribed to. Params is required by the UseCase to retrieve the appropraite data from the repository
override
dispose() → void
Disposes (unsubscribes) from the Stream
inherited
execute(Observer<void> observer, [Params? params]) → void
Subscribes to the Observerable with the Observer callback functions.
inherited
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