Skip to content

Instantly share code, notes, and snippets.

@PreyeaRegmi
Last active June 29, 2021 10:42
Show Gist options
  • Save PreyeaRegmi/b31dd9f47c379efa107bc9111dca2b31 to your computer and use it in GitHub Desktop.
Save PreyeaRegmi/b31dd9f47c379efa107bc9111dca2b31 to your computer and use it in GitHub Desktop.
Base use-case class in the application layer.
abstract class BaseUseCase<P, R> {
Stream<R> buildUseCase(P param);
StreamSubscription<R> execute(P param,void Function(R) result,void Function(String) error)
{
return buildUseCase(param).listen(result,onError: (Object exception, StackTrace stackTrace){
error(exception.toString());
});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment