toString method Null safety

String toString()
override

A valid RFC 5545 string representation of this recurrence rule, except when end is specified as End.Until. When End.Until is specified, 'UNTIL' holds the total number of microseconds which need to be added to a desired start date. 'UNTIL' should be reassigned to a calculated end date time, formatted using the RFC 5545 specifications: https://tools.ietf.org/html/rfc5545#section-3.3.5

Implementation

String toString() {
  String rule = 'RRULE:FREQ=$frequency';
  rule += (interval != 1) ? ';INTERVAL=$interval' : '';
  rule += (end!.type != EndType.NEVER) ? rule += ';$end' : '';

  return rule;
}