Skip to content

frknkrc44/vcf_dart

Repository files navigation

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...

About

A VCF library which supports read/create/write VCF files.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published