paginate
Platform-agnostic pagination library, with custom support for theAngel framework.
Installation
In your pubspec.yaml file:
1. dependencies:
2. angel_paginate: ^2.0.0
Usage
This library exports a Paginator<T>, which can be used to efficiently produceinstances of PaginationResult<T>. Pagination results, when serialized to JSON, look likethis:
1. {
2. "total" : 75,
3. "items_per_page" : 10,
4. "previous_page" : 3,
5. "current_page" : 4,
6. "next_page" : 5,
7. "start_index" : 30,
8. "end_index" : 39,
9. "data" : ["<items...>"]
10. }
Results can be parsed from Maps using the PaginationResult<T>.fromMap constructor, andserialized via their toJson() method.
To create a paginator:
1. import 'package:angel_paginate/angel_paginate.dart';
3. main() {
4. var p = new Paginator(iterable);
6. // Get the current page (default: page 1)
7. var page = p.current;
8. print(page.total);
9. print(page.startIndex);
10. print(page.data); // The actual items on this page.
11. p.next(); // Advance a page
12. p.back(); // Back one page
13. p.goToPage(10); // Go to page number (1-based, not a 0-based index)
14. }
The entire Paginator API is documented, so check out the DartDocs.
Paginators by default cache paginations, to improve performance as you shift through pages.This can be especially helpful in a client-side application where your UX involves a fastresponse time, i.e. a search page.

