Skip to content
This repository was archived by the owner on Sep 14, 2024. It is now read-only.

Commit 98c2f23

Browse files
committed
make AnimatedList an Iterable
1 parent 31a30e4 commit 98c2f23

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

lib/src/models/animated_list.dart

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ typedef RemovedItemBuilder<T> = Widget Function(
88
Animation<double> animation,
99
);
1010

11-
abstract class AnimatedListModel<E> {
11+
abstract class AnimatedListModel<E> extends Iterable<E> {
1212
AnimatedListModel({
1313
required this.listKey,
1414
required this.removedItemBuilder,
@@ -54,13 +54,16 @@ abstract class AnimatedListModel<E> {
5454
}
5555
}
5656

57+
@override
5758
bool get isNotEmpty => _items.isNotEmpty;
5859

60+
@override
5961
int get length => _items.length;
6062

6163
E operator [](int index) => _items[index];
6264

63-
int indexOf(E item) => _items.indexOf(item);
65+
@override
66+
Iterator<E> get iterator => _items.iterator;
6467
}
6568

6669
class AnimatedTimerList extends AnimatedListModel<Timer> {

0 commit comments

Comments
 (0)