peek method
Return the next howMany
items, or as many as there are remaining.
Does not modify the stream position.
Implementation
dynamic peek([int howMany = 1]) {
dynamic result;
if (contents is String) {
String stringContents = contents;
result = stringContents.substring(
index, min(index + howMany, stringContents.length));
} else {
// Assume List
result = contents.sublist(index, index + howMany);
}
return result;
}