repeat static method

ByteStream repeat(
  1. List<int> bytes, [
  2. int? count
])

Creates a ByteStream that repeats the given bytes.

bytes the bytes to repeat count the number of times to repeat (null for infinite)

Implementation

static ByteStream repeat(List<int> bytes, [int? count]) {
  if (count == null) {
    return ByteStream._(Stream.periodic(Duration.zero, (_) => bytes));
  } else {
    return ByteStream._(Stream.fromIterable(List.filled(count, bytes)));
  }
}