Gateway<M extends DomainModel, R extends Request, P extends SuccessResponse, S extends SuccessDomainInput> constructor

Gateway<M extends DomainModel, R extends Request, P extends SuccessResponse, S extends SuccessDomainInput>({
  1. ProvidersContext? context,
  2. UseCaseProvider<Entity, UseCase<Entity>>? provider,
  3. UseCase<Entity>? useCase,
})

Implementation

Gateway({
  ProvidersContext? context,
  UseCaseProvider? provider,
  UseCase? useCase,
}) : assert(
        () {
          return (context != null && provider != null) || useCase != null;
        }(),
        '',
      ) {
  _useCase = useCase ?? provider!.getUseCaseFromContext(context!);
  _useCase.subscribe<M, S>(
    (domainModel) => _processRequest(buildRequest(domainModel)),
  );
}