Skip to content

Commit 8110028

Browse files
author
Joshua Matta
committed
Update README.md to include pageData method
1 parent 4a17737 commit 8110028

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,20 @@ There are two required parameters:
2727
- itemBuilder: requires a widget and gives you the item of type \<T\> to be displayed
2828

2929
```dart
30+
31+
// mocking a network call
32+
Future<List<String>> pageData(int previousCount) async {
33+
await Future.delayed(Duration(seconds: 0, milliseconds: 2000));
34+
List<String> dummyList = List();
35+
if (previousCount < 30) {
36+
// stop loading after 30 items
37+
for (int i = previousCount; i < previousCount + _COUNT; i++) {
38+
dummyList.add('Item $i');
39+
}
40+
}
41+
return dummyList;
42+
}
43+
3044
@override
3145
Widget build(BuildContext context) {
3246
return Scaffold(

0 commit comments

Comments
 (0)