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.
getter/setter pair
firstPhonetic String
Phonetic first name.
getter/setter pair
hashCode int
The hash code for this object.
no setteroverride
last String
Last name / family name.
getter/setter pair
lastPhonetic String
Phonetic last name.
getter/setter pair
middle String
Middle name.
getter/setter pair
middlePhonetic String
Phonetic middle name.
getter/setter pair
nickname String
Nickname / short name.
getter/setter pair
prefix String
Prefix / title, e.g. "Dr" in American names.
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
suffix String
Suffix, e.g. "Jr" in American names.
getter/setter pair

Methods

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

Operators

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