Index: lib/src/protobuf/pb_list.dart |
diff --git a/lib/src/protobuf/pb_list.dart b/lib/src/protobuf/pb_list.dart |
index e2b518d5ada4b5764372a73314f1690119342be1..46644e598a6312c8c6737e603f9d0ec8102eecde 100644 |
--- a/lib/src/protobuf/pb_list.dart |
+++ b/lib/src/protobuf/pb_list.dart |
@@ -88,7 +88,9 @@ class PbList<E> extends Object with ListMixin<E> implements List<E> { |
* not extendable. |
*/ |
void setRange(int start, int end, Iterable<E> from, [int skipCount = 0]) { |
- from.sublist(skipCount, skipCount + end - start).forEach(_validate); |
+ // NOTE: In case `take()` returns less than `end - start` elements, the |
+ // _wrappedList will fail with a `StateError`. |
+ from.skip(skipCount).take(end - start).forEach(_validate); |
_wrappedList.setRange(start, end, from, skipCount); |
} |