Name class
A 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 | ✔ | ✔ |
- Annotations
- @JsonSerializable(disallowUnrecognizedKeys: true)
Constructors
Properties
- first ↔ String
-
First name / given name
@JsonKey(defaultValue: ""), read / write
- firstPhonetic ↔ String
-
Phonetic version of the first name (usually for Chinese/Japanese/Korean
names)
@JsonKey(defaultValue: ""), read / write
- hashCode → int
-
The hash code for this object. [...]
read-only, inherited
- last ↔ String
-
Last name / surname / family name
@JsonKey(defaultValue: ""), read / write
- lastPhonetic ↔ String
-
Phonetic version of the last name (usually for Chinese/Japanese/Korean
names)
@JsonKey(defaultValue: ""), read / write
- middle ↔ String
-
Middle name (US). Could mean additional names in other countries
(e.g. France)
@JsonKey(defaultValue: ""), read / write
- middlePhonetic ↔ String
-
Phonetic version of the middle name (usually for Chinese/Japanese/Korean
names)
@JsonKey(defaultValue: ""), read / write
- nickname ↔ String
-
Nickname, e.g. maiden name, short name, initials, or any other name.
@JsonKey(defaultValue: ""), read / write
- prefix ↔ String
-
Prefix (US) or title, e.g. Dr, Mr, Sir, etc
@JsonKey(defaultValue: ""), read / write
- runtimeType → Type
-
A representation of the runtime type of the object.
read-only, inherited
- suffix ↔ String
-
Suffix (US), e.g Jr or III
@JsonKey(defaultValue: ""), 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.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator. [...]
inherited