simple_vcard_parser 0.2.0 copy "simple_vcard_parser: ^0.2.0" to clipboard
simple_vcard_parser: ^0.2.0 copied to clipboard

A simple and easy to use parser to extract information from a standard vCard string. Major vCard properties from versions 2.1, 3.0, 4.0 are supported.

example/main.dart

//import 'package:simple_vcard_parser/simple_vcard_parser.dart';

import '../lib/simple_vcard_parser.dart';

String vCardExample40 = '''BEGIN:VCARD
VERSION:4.0
N:Gump;Forrest;;Mr.;
FN:Forrest Gump
ORG:Bubba Gump Shrimp Co.
TITLE:Shrimp Man
PHOTO;MEDIATYPE=image/gif:http://www.example.com/dir_photos/my_photo.gif
TEL;TYPE=work,voice;VALUE=uri:tel:+1-111-555-1212
TEL;TYPE=home,voice;VALUE=uri:tel:+1-404-555-1212
ADR;TYPE=WORK;PREF=1;LABEL="100 Waters Edge\nBaytown\, LA 30314\nUnited States of America":;;100 Waters Edge;Baytown;LA;30314;United States of America
ADR;TYPE=HOME;LABEL="42 Plantation St.\nBaytown\, LA 30314\nUnited States of America":;;42 Plantation St.;Baytown;LA;30314;United States of America
EMAIL;TYPE=INTERNET:[email protected]
GENDER:M
REV:20080424T195243Z
x-qq:21588891
END:VCARD''';

void main() {
  VCard vc = VCard(vCardExample40);
  print(vc.version); // 4.0
  print(vc.formattedName); // Forrest Gump
  print(vc.organisation); // Bubba Gump Shrimp Co.
  print(vc.title); //Shrimp Man
  print(vc.typedEmail); // [[[email protected], [INTERNET]]]
  print(vc
      .typedTelephone); // [[+1-111-555-1212, [VOICE, WORK]], [+1-404-555-1212, [HOME, VOICE]]]
  print(vc.name); //[Gump, Forrest, , Mr.,]
  print(vc.gender); //M
  print(vc
      .typedAddress); // [[[100 Waters Edge, Baytown, LA 30314, United States of America], [WORK]], [[42 Plantation St., Baytown, LA 30314, United States of America], [HOME]]]
  vc.print_lines(); // Will print all vcard lines without start and end tags

  // getWordOfPrefix() can be used to retrieve values from currently unsupported properties
  print(vc.getWordOfPrefix(
      "PHOTO;MEDIATYPE=image/gif:")); //http://www.example.com/dir_photos/my_photo.gif
}
8
likes
120
pub points
81%
popularity

Publisher

unverified uploader

A simple and easy to use parser to extract information from a standard vCard string. Major vCard properties from versions 2.1, 3.0, 4.0 are supported.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (LICENSE)

More

Packages that depend on simple_vcard_parser