notAfter property Null safety

DateTime notAfter

The end time which this certificate is valid.

Implementation

DateTime get notAfter {
  final validity = _tbs.elements![_offset + 4] as ASN1Sequence;
  final time = validity.elements![1];
  if (time is ASN1UtcTime) {
    return time.time!;
  }
  if (time is ASN1GeneralizedTime) {
    return time.dateTimeValue!.toUtc();
  }
  throw Exception('Unable to decode time');
}