BlocxPaginatedUseCase<Input extends BlocxPaginatedInput, Output extends BlocxBaseEntity> class abstract

Base use case for paginated list operations.

Extend this instead of BlocxBaseUseCase whenever the output is a page of BlocxBaseEntity items. It inherits full error handling from BlocxBaseUseCase and adds successResult to eliminate the BlocxPage construction boilerplate.

Minimal implementation

class GetOrdersUseCase extends BlocxPaginationUseCase<BlocxPaginationInput, Order> {
  final OrderRepository _repo;
  GetOrdersUseCase(this._repo);

  @override
  Future<BlocxUseCaseResult<BlocxPage<Order>>> perform(BlocxPaginationInput input) async {
    final orders = await _repo.getOrders(limit: input.limit, offset: input.offset);
    return successResult(items: orders, input: input);
  }
}

Custom input

Pass a subclass of BlocxPaginatedInput to attach filters or sorting:

class GetFilteredOrdersUseCase
    extends BlocxPaginationUseCase<OrderFilterInput, Order> { ... }
Inheritance
Implementers

Constructors

BlocxPaginatedUseCase()

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

execute(Input input) Future<BlocxUseCaseResult<BlocxPage<Output>>>
Entry point for callers. Do not override.
inherited
failureResult(Object error, StackTrace stackTrace) FutureOr<BlocxUseCaseResult<BlocxPage<Output>>>
Wraps an unhandled exception into a BlocxUseCaseResult.
inherited
handleError(Object error, StackTrace stackTrace) → void
Optional side-effect hook for logging, analytics, or crash reporting.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
perform(Input input) Future<BlocxUseCaseResult<BlocxPage<Output>>>
The business logic implementation.
inherited
success(BlocxPage<Output> data) BlocxUseCaseResult<BlocxPage<Output>>
Shorthand for BlocxUseCaseSuccess(data).
inherited
successResult({required List<Output> items, required BlocxPaginatedInput input}) BlocxUseCaseResult<BlocxPage<Output>>
Builds a successful paginated result from items and the originating input.
toString() String
A string representation of this object.
inherited

Operators

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