Skip to content

Latest commit

 

History

History
80 lines (62 loc) · 1.36 KB

README.md

File metadata and controls

80 lines (62 loc) · 1.36 KB

VCF Dart

Features

This library supports create and parse VCard files.

Tested versions

  • 2.1
  • 3.0
  • 4.0

Getting started

Add this package to your dependency list:

dart pub add vcf_dart

Include into your project:

import 'package:vcf_dart/vcf_dart.dart';

Usage

Parse the existing VCard file and print its content:

const localStr = """BEGIN:VCARD
VERSION:3.0
N:User;Test
FN:Test User
EMAIL;TYPE=HOME:[email protected]
END:VCARD""";

final stack = VCardStack.fromData(localStr);
print(stack.vcardStack);

For more examples, check the example folder.

Create an empty VCard stack and add a VCard element:

final stack = VCardStack();
final builder = VCardItemBuilder()
  ..addProperty(
    const VCardProperty(
      name: VConstants.name,
      values: ['User', 'Test'],
    ),
  )
  ..addPropertyFromEntry(
    VConstants.formattedName,
    'Test User',
  )
  ..addProperty(
    const VCardProperty(
      name: VConstants.email,
      nameParameters: [
        VCardNameParameter(
          VConstants.nameParamType,
          VConstants.phoneTypeHome,
        ),
      ],
      values: ['[email protected]'],
    ),
  );
stack.items.add(builder.build());

TODO

  • AGENT type support
  • Add more checks for invalid VCF files
  • Add more tests and examples
  • And more...