Name class

Structured name.

Name structure varies widely by country. See: https://en.wikipedia.org/wiki/Personal_name#Structure

Data models such as those from Android and iOS are typically US-centric and include middle name, prefix, suffix, etc. They also always include a formatted displayed, which we recommend to use instead. That said, other fields are included for compatibility, except for first and last names which are common in most countries.

Since display name is always part of the top-level contact, it's not included here.

Note that Android allows multiple names, while iOS allows only one. However use cases for multiple names are debatable, especially since there is no notion of "primary" name even on Android, and it is very common to see multiple identical instances of the same name for the same contact. For all those reasons, we only support one name per contact.

Note also that on iOS, nickname is included in the name fields (and again only one is allowed), while on Android nickname is a separate data model and one contact can have multiple nicknames, independent of their names. They can also have distinct labels to indicate what type of nickname they are (maiden name, short name, initials, default, other or any custom label). To simplify, we only consider nickname as just another name field, and disregard nickname labels.

| Field | Android | iOS | |--------------------|:-------:|:---:| | first | ✔ | ✔ | | last | ✔ | ✔ | | middle | ✔ | ✔ | | prefix | ✔ | ✔ | | suffix | ✔ | ✔ | | nickname | ✔ | ✔ | | firstPhonetic | ✔ | ✔ | | lastPhonetic | ✔ | ✔ | | middlePhonetic | ✔ | ✔ |

Constructors

Name({String first: '', String last: '', String middle: '', String prefix: '', String suffix: '', String nickname: '', String firstPhonetic: '', String lastPhonetic: '', String middlePhonetic: ''})
Name.fromJson(Map<String, dynamic> json)
factory

Properties

first String
First name / given name.
read / write
firstPhonetic String
Phonetic first name.
read / write
hashCode int
The hash code for this object. [...]
read-only, override
last String
Last name / family name.
read / write
lastPhonetic String
Phonetic last name.
read / write
middle String
Middle name.
read / write
middlePhonetic String
Phonetic middle name.
read / write
nickname String
Nickname / short name.
read / write
prefix String
Prefix / title, e.g. "Dr" in American names.
read / write
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited
suffix String
Suffix, e.g. "Jr" in American names.
read / write

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
inherited
toJson() Map<String, dynamic>
toString() String
Returns a string representation of this object.
override
toVCard() List<String>

Operators

operator ==(Object o) bool
The equality operator. [...]
override