This commit is contained in:
2026-05-19 12:46:13 +02:00
parent 3f2f55d6c2
commit 3ecf617998
10 changed files with 313 additions and 16 deletions

View File

@@ -17,12 +17,12 @@ class LatestStoreOperationsBloc
status: LatestStoreOperationsStatus.initial,
),
) {
on<InitLastStoreOperationsEvent>((event, emit) async {
on<InitLatestStoreOperationsEvent>((event, emit) async {
emit(state.copyWith(status: LatestStoreOperationsStatus.loading));
try {
// 1. Creiamo uno stream "intermedio" che idrata i dati
final hydratedStream = _repository
.getLastStoreOperationsStream(storeId: event.storeId, limit: 5)
.getLatestStoreOperationsStream(storeId: event.storeId, limit: 10)
.asyncMap((List<OperationModel> rawOperations) async {
// Questo gira ad ogni "scatto" dello stream di Supabase
List<OperationModel> fullyHydratedOperations = [];

View File

@@ -7,10 +7,10 @@ sealed class LatestStoreOperationsEvent extends Equatable {
List<Object> get props => [];
}
class InitLastStoreOperationsEvent extends LatestStoreOperationsEvent {
class InitLatestStoreOperationsEvent extends LatestStoreOperationsEvent {
final String storeId;
const InitLastStoreOperationsEvent(this.storeId);
const InitLatestStoreOperationsEvent(this.storeId);
@override
List<Object> get props => [storeId];