toVCard method

List<String> toVCard()

Implementation

List<String> toVCard() {
  // EMAIL (V3): https://tools.ietf.org/html/rfc2426#section-3.3.2
  // EMAIL (V4): https://tools.ietf.org/html/rfc6350#section-6.4.2
  var s = 'EMAIL';
  if (FlutterContacts.config.vCardVersion == VCardVersion.v3) {
    s += ';TYPE=internet';
  } else {
    switch (label) {
      case EmailLabel.home:
        s += ';TYPE=home';
        break;
      case EmailLabel.work:
        s += ';TYPE=work';
        break;
      default:
    }
  }
  if (isPrimary) {
    if (FlutterContacts.config.vCardVersion == VCardVersion.v3) {
      s += ',pref';
    } else {
      s += ';PREF=1';
    }
  }
  s += ':${vCardEncode(address)}';
  return [s];
}