CollectionItem<T> class
Wrapper class containing item data and position helpers.
Example usage:
CollectionView<String>(
data: () => ['Item 1', 'Item 2', 'Item 3'],
builder: (context, item) {
return Container(
color: item.isEven ? Colors.grey : Colors.white,
child: Text('${item.data} at index ${item.index}'),
);
},
)
Constructors
- CollectionItem({required T data, required int index, required int totalItems})
-
const
Properties
- data → T
-
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- index → int
-
final
- isEven → bool
-
Whether this item is at an even index.
no setter
- isFirst → bool
-
Whether this is the first item in the list.
no setter
- isLast → bool
-
Whether this is the last item in the list.
no setter
- isOdd → bool
-
Whether this item is at an odd index.
no setter
- progress → double
-
Progress through the list (0.0 to 1.0).
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- totalItems → int
-
final
Methods
-
isAt(
int position) → bool -
Whether this item is at the specified
position. -
isInRange(
int start, int end) → bool - Whether this item's index is within the specified range (inclusive).
-
isMultipleOf(
int divisor) → bool -
Whether this item's index is a multiple of
divisor. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited