hideData method
String
hideData({
- required String data,
- required List<
HideRegExp> hideRegExps, - bool ignoreError = false,
Implementation
String hideData({
required String data,
required List<HideRegExp> hideRegExps,
bool ignoreError = false,
}) {
for (var i = 0; i < hideRegExps.length; i++) {
try {
HideRegExp hideRegExp = hideRegExps[i];
if (hideRegExp.regExp.hashData(data)) {
if (hideRegExp.hideDataType == HideDataType.replace) {
data = data.replaceAll(hideRegExp.regExp, hideRegExp.replace);
}
if (hideRegExp.hideDataType == HideDataType.obfuscate) {
data = obfocustData(
mystring: data,
start: hideRegExp.startIndexObfuscate,
end: hideRegExp.endIndexObfuscate,
);
}
}
} catch (e) {
if (ignoreError) {
continue;
} else {
rethrow;
}
}
}
return data;
}