InfiniteListView显示错误RangeError(索引):无效值:不在范围0..9(包括):-1

时间:2020-03-30 05:01:55

标签: listview flutter

我想制作无限滚动的列表视图,所以我使用了https://pub.dev/packages/infinite_listview库。现在,我有一个错误告诉我RangeError(索引):无效值:不在范围0..9,包括:-1和RangeError(索引):无效值:不在范围0..9,包括:10 从双方。帮帮我;)

class ListPhotosWidget extends StatelessWidget {
  final PhotosList photosList;

  ListPhotosWidget({Key key, @required this.photosList}) : super(key: key);

<code>  InfiniteScrollController _controller =
  InfiniteScrollController(initialScrollOffset: 0.0);

  @override
  Widget build(BuildContext context) {
    return InfiniteListView.builder(
      controller: _controller,
      itemBuilder: (BuildContext context, int index) {
        return PhotoItem(photo: photosList.photos[index]);
      },
    );
  }
}

0 个答案:

没有答案