getRegexKeyFromKey function
This method retrieves the regex key associated with the given key from the remote database It first retrieves all regex keys using the 'getRegexKeys' method It searches for an index where the regex key contains the given key If an index is found, it assigns the corresponding regex key to 'regexKey' and returns it If no index is found, it returns null
Implementation
Future<String?> getRegexKeyFromKey(String key) async {
String regexKey;
var allRegex = await getRegexKeys();
var index = allRegex.indexWhere((element) => element.contains(key));
if (index > -1) {
regexKey = allRegex[index];
return regexKey;
} else {
return null;
}
}