Shalaby-VBS / Easy_Pagination_Cubit

Easy Pagination is a simple and efficient pagination Repo for Flutter applications. This repo allows you to easily implement pagination in your Flutter apps with minimal setup and code. It's designed to be highly customizable and compatible with various data sources.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

πŸ“– Easy Pagination Cubit πŸ“–

πŸš€ Getting Started

  • A Flutter application showcasing pagination implementation using the flutter_bloc library. This project demonstrates how to efficiently load and display data in chunks, providing a smooth user experience with minimal resource consumption.

πŸͺ„ Features

  • Pagination with Cubit: Utilize the power of flutter_bloc for efficient state management in paginated scenarios.

  • Efficient Data Loading: Load data in chunks to minimize the impact on performance.

  • Loading States: Handle loading states to keep users informed during data fetching.

  • Error Handling: Gracefully handle errors during data retrieval.


βš™οΈ Customization

  • Customize the appearance and behavior of the clipboard according to your requirements:

PaginationCubit:

class PaginationCubit extends Cubit<List<dynamic>> {
  PaginationCubit() : super([]);

  int _page = 1;
  bool _isFetching = false;

  Future<void> fetchItems() async {
    if (_isFetching) return;
    _isFetching = true;

    try {
      final response = await Dio().get(
          'https://jsonplaceholder.typicode.com/posts',
          queryParameters: {'_page': _page, '_limit': 10});
      final List<dynamic> items = response.data;
      emit(List.from(state)..addAll(items));
      _page++;
      debugPrint('Page: $_page');
    } catch (e) {
      debugPrint('Error: $e');
    } finally {
      debugPrint('Total Fetched Items Num: ${state.length}');
      _isFetching = false;
    }
  }
}

πŸ“± UI

Easy.Pagination.Cubit.mp4

πŸ›  Dependencies

  flutter_bloc: ^8.0.0
  dio: ^4.0.0

🫴 Contributing

  • Contributions are welcome πŸ’œ
  • If you find any issues or have suggestions for improvements, feel free to open an issue or submit a pull request.

πŸ’³ License

License: MIT Version

  • This package is distributed under the MIT License. Feel free to use and modify it according to your project requirements.

🀝 Contact With Me

LinkedIn Gmail Facebook Instagram


πŸ’– Support

  • If you find this tutorial useful or learned something from this code, consider show some ❀️ by starring this repo.

About

Easy Pagination is a simple and efficient pagination Repo for Flutter applications. This repo allows you to easily implement pagination in your Flutter apps with minimal setup and code. It's designed to be highly customizable and compatible with various data sources.


Languages

Language:Dart 80.7%Language:Swift 15.4%Language:Kotlin 3.0%Language:Objective-C 0.9%