MailAddress class Null safety

An email address can consist of separate fields



MailAddress(String? personalName, String email)
MailAddress.fromEnvelope(String? personalName, String? sourceRoute, String? mailboxName, String? hostName)


email String
read / write
hashCode int
The hash code for this object. [...]
read-only, inherited
hasPersonalName bool
Checks if this address has a personal name
hostName String?
read / write
mailboxName String?
read / write
personalName String?
read / write
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited
sourceRoute String?
read / write


encode() String
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
read(Map<String, dynamic> attributes) → void
Reads all field keys and values from the specified attributes map. This method is called after the de-serialization. [...]
toString() String
A string representation of this object. [...]
write(Map<String, dynamic> attributes) → void
Sets all field keys and values in the specified attributes map. This method is called before the serialization. [...]
writeToStringBuffer(StringBuffer buffer) → void


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

Static Methods

getMatch(List<MailAddress> searchForList, List<MailAddress>? searchInList, {bool handlePlusAliases = false, bool removeMatch = false, bool useMatchPersonalName = false}) MailAddress?
Searches the searchForList addresses in the searchInList list. Set handlePlusAliases to true in case plus aliases should be checked, too. Set removeMatch to true in case the matching address should be removed from the searchInList list. Set useMatchPersonalName to true to return the personal name from the searchInList in the returned match. By default the personal name is retrieved from the matching entry in searchForList.
getMatchingEmail(String original, String check, {bool allowPlusAlias = false}) String?
Checks if both email addresses original and check match and returns the match. Set allowPlusAlias if plus aliases should be checked, so that name+alias@domain matches the original name@domain.