checkStreamTimestamp function

void checkStreamTimestamp(
  1. int timestampMilliseconds,
  2. int? previous
)

Throws ArgumentError unless timestampMilliseconds is nonnegative, at most maxStreamTimestampMilliseconds and above previous, the last timestamp the task accepted (null before the first): Google's runtimes refuse a timestamp that does not increase.

Implementation

void checkStreamTimestamp(int timestampMilliseconds, int? previous) {
  if (timestampMilliseconds < 0 ||
      timestampMilliseconds > maxStreamTimestampMilliseconds ||
      (previous != null && timestampMilliseconds <= previous)) {
    throw ArgumentError.value(
      timestampMilliseconds,
      'timestampMilliseconds',
      'Must be nonnegative, strictly increasing and at most '
          '$maxStreamTimestampMilliseconds',
    );
  }
}