vcf_dart 1.0.2
vcf_dart: ^1.0.2 copied to clipboard
A VCF (VCard) file parser from scratch. It contains support for VCard 2.x-4.x (except the AGENT type).
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
copied to clipboard
Include into your project:
import 'package:vcf_dart/vcf_dart.dart';
copied to clipboard
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:test@mail.com
END:VCARD""";
final stack = VCardStack.fromData(localStr);
print(stack.vcardStack);
copied to clipboard
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: ['test@mail.com'],
),
);
stack.items.add(builder.build());
copied to clipboard
TODO #
- AGENT type support
- Add more checks for invalid VCF files
- Add more tests and examples
- And more...