PaginatedList<T> class

PaginatedList is a representation of a portion of a bigger list at a given time. This is used to track a remote list while locally supporting only a small portion of data.

  • items is the current list of fetched data. items's length is lesser or equals to total
  • page is the last tracked page of the remote list
  • total is the length of the remote list
Inheritance

Constructors

PaginatedList.new({required Iterable<T> items, required int page, required int total})

Properties

hashCode int
The hash code for this object.
no setterinherited
hasReachedMax bool
whether the local list is the same length as the remote list
no setter
items List<T>
no setter
page int
final
props List<Object?>
The list of properties that will be used to determine whether two instances are equal.
no setteroverride
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
stringify bool?
If set to true, the toString method will be overridden to output this instance's props.
no setterinherited
total int
final

Methods

add({required Iterable<T> others, int? page, int? total}) PaginatedList<T>
adds items at the end of the current list. You can set the current page or total according to the data source
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
prepend({required Iterable<T> others, int? page, int? total}) PaginatedList<T>
adds items at the beginning of the current list. You can set the current page or total according to the data source
remove(T item, {bool update = false}) PaginatedList<T>
removes an item from the list. Set update to true in order to remove one to the total value. Keep in mind that total tracks the length of the remote list, so you might get inconsistencies when editing it
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited