MeCard.contact constructor
MeCard.contact({})
Create a contact MeCard
Implementation
factory MeCard.contact({
String? name,
String? reading,
String? tel,
List<String>? tels,
String? videophone,
String? email,
List<String>? emails,
String? memo,
DateTime? birthday,
String? address,
String? url,
List<String>? urls,
String? nickname,
}) {
final fields = <MeTuple>[];
if (name != null) {
fields.add(MeTuple('N', name));
}
if (reading != null) {
fields.add(MeTuple('SOUND', reading));
}
if (tel != null) {
fields.add(MeTuple('TEL', tel));
}
if (tels != null) {
for (final tel in tels) {
fields.add(MeTuple('TEL', tel));
}
}
if (videophone != null) {
fields.add(MeTuple('TEL-AV', videophone));
}
if (email != null) {
fields.add(MeTuple('EMAIL', email));
}
if (emails != null) {
for (final email in emails) {
fields.add(MeTuple('EMAIL', email));
}
}
if (memo != null) {
fields.add(MeTuple('NOTE', memo));
}
if (birthday != null) {
fields.add(MeTuple.date('BDAY', birthday));
}
if (address != null) {
fields.add(MeTuple('ADR', address));
}
if (url != null) {
fields.add(MeTuple('URL', url));
}
if (urls != null) {
for (final url in urls) {
fields.add(MeTuple('URL', url));
}
}
if (nickname != null) {
fields.add(MeTuple('NICKNAME', nickname));
}
return MeCard(fields: fields);
}