You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

31 lines
913B

  1. part of 'infinity_scroll_bloc.dart';
  2. abstract class InfinityScrollState extends Equatable {
  3. const InfinityScrollState();
  4. @override
  5. List<Object> get props => [];
  6. }
  7. class InfinityScrollInitial extends InfinityScrollState {}
  8. class InfinityScrollFailure extends InfinityScrollState {
  9. final String errorString;
  10. InfinityScrollFailure({required this.errorString});
  11. }
  12. class InfinityScrollSuccess<T> extends InfinityScrollState {
  13. final List<T> items;
  14. final int page;
  15. final bool hasReachedMax;
  16. const InfinityScrollSuccess({required this.items, required this.page, required this.hasReachedMax});
  17. InfinityScrollSuccess copyWith({List<T>? items, int? page, required bool hasReachedMax}) {
  18. return InfinityScrollSuccess(items: items ?? this.items, page: page ?? this.page, hasReachedMax: hasReachedMax ?? this.hasReachedMax);
  19. }
  20. @override
  21. List<Object> get props => [items, hasReachedMax];
  22. }