perform method
The business logic implementation.
Called by execute. Throw freely — exceptions are caught and converted to BlocxUseCaseFailure automatically.
Return values via success:
return success(myOutput);
Implementation
@override
Future<BlocxUseCaseResult<BlocxPage<T>>> perform(
BlocxPaginatedInput input,
) async {
recordedInputs.add(input);
if (delay > Duration.zero) await Future<void>.delayed(delay);
if (completer != null) await completer!.future;
if (shouldFail) throw failureError ?? Exception('Paginated task failed');
final page = source.getPage(offset: input.offset, limit: input.limit);
return success(page);
}