Pagination Simple Provider is a Flutter project that demonstrates how to implement pagination using Provider for state management. This project fetches data from an API (jsonplaceholder.typicode.com) and displays it in a list with pagination support.
- Fetches data from an API using HTTP requests.
- Implements pagination to load more data as the user scrolls.
- Uses Provider package for state management.
You can find a detailed explanation of this project on Medium.
- Flutter SDK installed on your machine. You can get it from here.
- An IDE (such as Android Studio, VSCode) with Flutter support.
- Clone the repository to your local machine:
git clone https://github.com/your_username/pagination-simple-provider.git
- Navigate to the project directory:
cd pagination-simple-provider
- Install dependencies:
flutter pub get
- Run the app:
flutter run
Once the app is running, you will see a list of posts fetched from the API. Scroll down to load more posts as pagination is implemented. If there are no more posts to load, a message indicating the end of the list will be displayed.
- home_page.dart: Contains the UI implementation for the home page, including the ListView and pagination logic.
- home_provider.dart: Defines the Provider class responsible for fetching data and managing state.
- home_state.dart: Defines the state enum and state class used by the Provider.
- main.dart: Entry point of the application, sets up the Provider and initializes the home page.
- model.dart: Defines the data model for a Post.
Contributions are welcome! If you find any issues or want to add new features, feel free to open a pull request.
This project is licensed under the MIT License - see the LICENSE file for details.
- Thanks to the Flutter team for providing an amazing framework.
- Thanks to the Provider package contributors for simplifying state management in Flutter.
For any inquiries or suggestions, please contact bensatriya3@gmail.com.
This README template is inspired by PurpleBooth.