toString method Null safety

String toString()

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:


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

  return rule;