ContactKeys constructor
ContactKeys({})
Implementation
factory ContactKeys(
{required ContactMode? mode,
String? identifier,
String? singleContactId,
String? unifiedContactId,
Map<String, String>? otherKeys}) {
assert(mode != null || identifier == null,
"You must provide a mode if you provide an identifier");
if (mode == null) {
return ContactKeys._(
identifier: null,
mode: null,
unifiedContactId: unifiedContactId,
singleContactId: singleContactId,
otherKeys: otherKeys);
}
switch (mode) {
case ContactMode.single:
assert(identifier == null ||
singleContactId == null ||
identifier == singleContactId);
return ContactKeys._(
mode: mode,
identifier: identifier ?? singleContactId,
singleContactId: identifier ?? singleContactId,
unifiedContactId: unifiedContactId,
otherKeys: otherKeys,
);
case ContactMode.unified:
assert(identifier == null ||
unifiedContactId == null ||
identifier == unifiedContactId);
return ContactKeys._(
mode: mode,
identifier: identifier ?? unifiedContactId,
singleContactId: singleContactId,
unifiedContactId: identifier ?? unifiedContactId,
otherKeys: otherKeys,
);
default:
return (throw "This can't happen");
}
}