Contact class

A contact.

id represents the unified contact ID (a concept shared by android and iOS: e.g. a "raw contact" from Gmail and another one from WhatsApp may be merged into a single unfied contact, which is what we care about most of the time).

displayName is the only other required field, and represents a single-string representation of the contact's name.

Annotations
  • @JsonSerializable(explicitToJson: true, disallowUnrecognizedKeys: false, anyMap: true)

Constructors

Contact(String id, String displayName, {Uint8List photo, Name name, List<Phone> phones: const [], List<Email> emails: const [], List<Address> addresses: const [], List<Organization> organizations: const [], List<Website> websites: const [], List<SocialMedia> socialMedias: const [], List<Event> events: const [], List<Note> notes: const [], List<Account> accounts: const []})
Contact.create({bool createEmptyName: true})
Create a new contact, with empty contact ID and display name. [...]
Contact.fromJson(Map json)
factory

Properties

accounts List<Account>
Android raw accounts. Android only.
@JsonKey(defaultValue: const []), read / write
addresses List<Address>
Postal addresses
@JsonKey(defaultValue: const []), read / write
displayName String
Display name (name formatted into a single string). Always provided.
@JsonKey(required: true), read / write
emails List<Email>
Email addresses
@JsonKey(defaultValue: const []), read / write
events List<Event>
Events, such as birthday and anniversary
@JsonKey(defaultValue: const []), read / write
hashCode int
The hash code for this object. [...]
read-only, inherited
id String
Contact ID, corresponding to the native contact ID.
@JsonKey(required: true), read / write
name Name
Structured name of the contact [...]
@JsonKey(nullable: true), read / write
normalizedName String
Returns normalized display name, which ignores case, space and diacritics.
read-only
notes List<Note>
Notes (iOS supports only one, Android allows multiple notes)
@JsonKey(defaultValue: const []), read / write
organizations List<Organization>
Company / job [...]
@JsonKey(defaultValue: const []), read / write
phones List<Phone>
Phone numbers
@JsonKey(defaultValue: const []), read / write
photo Uint8List
Photo, which can be null [...]
@JsonKey(ignore: true), read / write
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited
socialMedias List<SocialMedia>
Social media profiles and instant messaging
@JsonKey(defaultValue: const []), read / write
websites List<Website>
Websites / URLs
@JsonKey(defaultValue: const []), read / write

Methods

deduplicateEmails() → void
deduplicatePhones() → void
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
inherited
toJson({bool includePhoto: false}) Map<String, dynamic>
toString() String
Returns a string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator. [...]
inherited