platform/packages/paginate/example/main.dart

16 lines
432 B
Dart
Raw Normal View History

2019-02-01 14:39:10 +00:00
import 'package:angel_paginate/angel_paginate.dart';
2021-06-20 12:37:20 +00:00
void main() {
2019-02-01 14:39:10 +00:00
var iterable = [1, 2, 3, 4];
2021-06-20 12:37:20 +00:00
var p = Paginator(iterable);
2019-02-01 14:39:10 +00:00
// Get the current page (default: page 1)
2021-06-20 12:37:20 +00:00
var page = p.current!;
2019-02-01 14:39:10 +00:00
print(page.total);
print(page.startIndex);
print(page.data); // The actual items on this page.
p.next(); // Advance a page
p.back(); // Back one page
p.goToPage(10); // Go to page number (1-based, not a 0-based index)
}