marcglasberg / indexed_list_view

Flutter package: Similar to a ListView, but lets you programmatically jump to any item, by index.
BSD 2-Clause "Simplified" License
251 stars 21 forks source link

how to set itemCount? #5

Closed linguitang closed 5 years ago

marcglasberg commented 5 years ago

You can't. That's for infinite lists only.

jamespfinn commented 5 years ago

@marcglasberg I'm not clear on your reply. Are you saying that the indexed_list_view plugin is only for infinite lists?

If I have a finite list the IndexedListView is showing out of range errors when I am referencing items from my array by index. It's seems that setting an itemCount (like ListView) would be the solution to setting the list size.

mestartlearncode commented 5 years ago

@marcglasberg Hi,

Can this plugin be able to be used on "finite" list ?

thank you

marcglasberg commented 5 years ago

Like I said, this plugin is for infinite lists only. You cannot have a start index, and you cannot have an end index. You cannot have an itemCount. You cannot prevent the user to scroll to infinity, both to the top and to the bottom of the list.

This is clearly stated in the plugin page: "Currently, the list is always infinite both to positive and negative indexes. In other words, it can be scrolled indefinitely both to the top and to the bottom."

marcglasberg commented 5 years ago

Please see this issue for possible solutions to your problem: https://github.com/flutter/flutter/issues/12319