You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
38 lines
793 B
38 lines
793 B
class ContactGroup {
|
|
final String name;
|
|
final List<String> memberKeys;
|
|
|
|
const ContactGroup({
|
|
required this.name,
|
|
required this.memberKeys,
|
|
});
|
|
|
|
ContactGroup copyWith({
|
|
String? name,
|
|
List<String>? memberKeys,
|
|
}) {
|
|
return ContactGroup(
|
|
name: name ?? this.name,
|
|
memberKeys: memberKeys ?? List<String>.from(this.memberKeys),
|
|
);
|
|
}
|
|
|
|
Map<String, dynamic> toJson() {
|
|
return {
|
|
'name': name,
|
|
'members': memberKeys,
|
|
};
|
|
}
|
|
|
|
factory ContactGroup.fromJson(Map<String, dynamic> json) {
|
|
final members = (json['members'] as List?)
|
|
?.map((value) => value.toString())
|
|
.toList() ??
|
|
<String>[];
|
|
return ContactGroup(
|
|
name: json['name'] as String? ?? '',
|
|
memberKeys: members,
|
|
);
|
|
}
|
|
}
|