Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug in fetchEvent #1

Open
chemickypes opened this issue Apr 27, 2020 · 0 comments
Open

Bug in fetchEvent #1

chemickypes opened this issue Apr 27, 2020 · 0 comments

Comments

@chemickypes
Copy link

Hi @xyarim
I saw that in the file photo_list_bloc.dart there are two bugs!

  • Instruction CurrentPage++ passes old value and then update itself
  • Unsplash api error: page=0 gives the same result of page=1

I fixed like following:

 if (currentState is InitialPhotoListState) {
          final photos = await photoRepository.getPhotos(1);
          yield PhotoListLoaded(photos, 1);
        } else if (currentState is PhotoListLoaded) {
          int currentPage = currentState.page + 1;
          final photos = await photoRepository.getPhotos(currentPage);
          print("current_page = $currentPage");
          yield photos.isEmpty
              ? currentState.copyWith(photos)
              : PhotoListLoaded(currentState.photos + photos, currentPage);
        }

I hope you'll enjoy it!

Angelo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant