y property

String get y

year number string whatever length it has

date.year should be greater or equal 0 or exception will be thrown

Implementation

String get y {
  final int year = date.year;

  if (year < 0) {
    throw StateError('date.year = $year < 0');
  }

  return year.toString();
}