Introduction

Pagination, the word itself tells us that we are talking about the numbering of any manuscript in our case data fetched from API. It’s always a best practice while working large data.

Prerequisites :

  • APIto get our beers.
  • BLoC for state management.
  • JSON Serializable to automate serialization-deserialization of the API response.

Initial Step

  • Create a new Flutter project.

Add the following dependencies in _pubspec.yaml_.

Image for post

pubspec.yaml

Project Folder Structure.

Image for post

folder structure

  • Now from **main.dart file** deletes all the content and types the below content. It includes the main methodinitial routes, and **BLoC observer **to debug. Next, we will create a beer Repository.

Image for post

#flutter #bloc #api #flutter-app-development #mobile-app-development

Paginate API results with BLoC in Flutter
21.20 GEEK