similarityTo method
Returns a similarity score between 0.0 (completely different) and 1.0 (identical), based on Levenshtein distance.
'hello'.similarityTo('hello') // 1.0
'kitten'.similarityTo('sitting') // ~0.57
Implementation
double similarityTo(String other) {
if (this == other) return 1.0;
if (isEmpty && other.isEmpty) return 1.0;
final maxLen = math.max(length, other.length);
if (maxLen == 0) return 1.0;
return 1.0 - levenshteinDistance(other) / maxLen;
}