toVCard method

List<String> toVCard()

Implementation

List<String> toVCard() {
  // ORG (V3): https://tools.ietf.org/html/rfc2426#section-3.5.5
  // TITLE (V3): https://tools.ietf.org/html/rfc2426#section-3.5.1
  // ROLE (V3): https://tools.ietf.org/html/rfc2426#section-3.5.2
  // ORG (V4): https://tools.ietf.org/html/rfc6350#section-6.6.4
  // TITLE (V4): https://tools.ietf.org/html/rfc6350#section-6.6.1
  // ROLE (V4): https://tools.ietf.org/html/rfc6350#section-6.6.2
  var lines = <String>[];
  if (company.isNotEmpty || department.isNotEmpty) {
    var s = 'ORG:${vCardEncode(company)}';
    if (department.isNotEmpty) {
      s += ';${vCardEncode(department)}';
    }
    lines.add(s);
  }
  if (title.isNotEmpty) {
    lines.add('TITLE:${vCardEncode(title)}');
  }
  if (jobDescription.isNotEmpty) {
    lines.add('ROLE:${vCardEncode(jobDescription)}');
  }
  return lines;
}