VendorBloc constructor

VendorBloc({
  1. required GetVendorProductsUseCase getVendorProductsUseCase,
})

Implementation

VendorBloc({
  required this.getVendorProductsUseCase,
}) : super(const VendorState()) {
  on<_Started>(_onStarted);
  // Handles product fetching with throttling to prevent frequent calls
  on<_VendorProductsFetched>(
    _onVendorProductsFetched,
    transformer: BlocUtil.throttleDroppable(
      const Duration(milliseconds: 100),
    ),
  );
  on<_VendorProductsRefreshed>(_onVendorProductsRefreshed);
  on<_ApplySortingButtonPressed>(_onApplySortingButtonPressed);
  // Restarts stream on search field change
  on<_SearchFieldValueChanged>(
    _onSearchFieldValueChanged,
    transformer: restartable(),
  );
}