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.

35 lines
908B

  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({this.items, this.page, this.hasReachedMax});
  17. InfinityScrollSuccess copyWith(
  18. {List<T> items, int page, bool hasReachedMax}) {
  19. return InfinityScrollSuccess(
  20. items: items ?? this.items,
  21. page: page ?? this.page,
  22. hasReachedMax: hasReachedMax ?? this.hasReachedMax);
  23. }
  24. @override
  25. List<Object> get props => [items, hasReachedMax];
  26. }