Timestamp constructor

Timestamp({
  1. required int seconds,
  2. required int nanoseconds,
})

Implementation

Timestamp({required this.seconds, required this.nanoseconds}) {
  const minSeconds = -62135596800;
  const maxSeconds = 253402300799;

  if (seconds < minSeconds || seconds > maxSeconds) {
    throw ArgumentError.value(
      seconds,
      'seconds',
      'must be between $minSeconds and $maxSeconds.',
    );
  }

  const maxNanoSeconds = 999999999;
  if (nanoseconds < 0 || nanoseconds > maxNanoSeconds) {
    throw ArgumentError.value(
      nanoseconds,
      'nanoseconds',
      'must be between 0 and $maxNanoSeconds.',
    );
  }
}