DoubleMetaphone class Null safety

Encodes a string to a Double Metaphone value. This implementation is based on the algorithm that was published by Lawrence Philips in Dr. Dobbs and includes fixes published by others since. By design, this encoding always contains two values. If there is no alternate, the primary and the alternate encodings will be the same.

Note that this implementation avoids any class corruption or concurrency problems by avoiding class properties. All of the data required is passed on the stack when each internal method is called.

This algorithm improves on the Soundex algorithm by using expert rules about inconsistencies in English spelling and pronunciation to produce a more accurate encoding, which does a better job of matching words and names which sound similar. Just like Soundex, similar-sounding words should share the same keys.

If you want (or need) to understand more details, here are some good references that help explain the details:

Implemented types

Constructors

DoubleMetaphone()
Gets the defaultEncoder instance of the encoder by default.
factory
DoubleMetaphone.withMaxLength(int maxLength)
Creates an instance with a custom maxLength.
factory

Properties

hashCode int
The hash code for this object. [...]
read-only, inherited
maxLength int
Maximum length of the encoding, where 0 indicates no maximum.
final
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited

Methods

encode(String input) PhoneticEncoding?
Encodes a string using the Double Metaphone algorithm as configured. [...]
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
inherited
toString() String
A string representation of this object. [...]
inherited

Operators

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

Static Properties

defaultEncoder DoubleMetaphone
An instance that uses defaultMaxLength for maxLength.
final

Constants

defaultMaxLength → const int
Default metaphone encoding length to use.
4