doesNamesContain2String method
checks whether name and family have been in inputNames or not. the first item of the list returned is the bool result and the second is the String result.
Implementation
List<dynamic> doesNamesContain2String(
String? name, String? family, List<String> inputNames) {
bool b = false;
String temp = '';
name = name!.toLowerCase().trim();
family = family!.toLowerCase().trim();
//.replaceAll('8', 'b').replaceAll("0", "o").replaceAll('2', 'z').replaceAll("9", "g")
if (name.length < 2) return [false, ''];
for (var s in inputNames) {
String fn = '';
List<String> fnList = s.split(" ");
for (int i = fnList.length; i > 0; i--) {
fn = fn + ' ' + fnList[i - 1];
}
fn = fn.trim();
if ("$name $family".contains(s.toLowerCase()) ||
checkSimilarity("$name $family", s)) {
b = true;
temp = s.toLowerCase();
} else if ("$name $family".contains(fn.toLowerCase()) ||
checkSimilarity("$name $family", fn)) {
b = true;
temp = fn.toLowerCase();
}
}
return [b, temp];
}