Attendee constructor

Attendee({
  1. required MailTo mailto,
  2. String? cn,
  3. Role? role,
  4. bool? rsvp,
  5. Partstat? partstat,
  6. Cutype? cutype,
  7. String? delegatedTo,
  8. String? delegatedFrom,
})

Implementation

Attendee({
  required this.mailto,
  this.cn,
  this.role,
  this.rsvp,
  this.partstat,
  this.cutype,
  this.delegatedTo,
  this.delegatedFrom,
}){
  int attributeCount=0;
  if(cn != null){attributeCount++;}
  if(role != null){attributeCount++;}
  if(rsvp != null){attributeCount++;}
  if(partstat != null){attributeCount++;}
  if(cutype != null){attributeCount++;}
  if(delegatedTo != null){
    if (!Heplers.isValidEmail(delegatedTo!)) {
      throw 'Invalid Attendee email format for mailTo';
    }
    attributeCount++;
  }
  if(delegatedFrom != null){
    if (!Heplers.isValidEmail(delegatedFrom!)) {
      throw 'Invalid Attendee email format for mailTo';
    }
    attributeCount++;
  }
  if(attributeCount > 1){
    throw 'Attendee cannot have more than one attribute';
  }
}