calculate function

Stream<double> calculate(
  1. Stream<int> sourceStream,
  2. int divideBy
)

Implementation

Stream<double> calculate(Stream<int> sourceStream, int divideBy) {
  return sourceStream.skip(1).startWith(5).map((event) {
    if (divideBy == 0) {
      throw DivideByZeroError();
    }

    return event / divideBy;
  });
}