Label<T extends Enum> class

Generic label wrapper that combines an enum label with an optional custom label string.

When label is a custom enum value (e.g., PhoneLabel.custom, EmailLabel.custom), customLabel must be provided.

When creating or updating contacts, unsupported labels on a platform are automatically converted to the custom enum value with the original label name preserved in customLabel.

Constructors

Label(T label, [String? customLabel])
const

Properties

customLabel String?
Custom label string used when label is a custom enum value (e.g., PhoneLabel.custom).
final
hashCode int
The hash code for this object.
no setteroverride
label → T
The standard label type (e.g., PhoneLabel.mobile, EmailLabel.work).
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

copyWith({T? label, String? customLabel}) Label<T>
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

Operators

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

Static Methods

fromJson<T extends Enum>(Map json, List<T> values, T defaultValue) Label<T>
Creates a Label from a JSON map.