mask method
Replaces all but the last num runes of a string with the specified mask.
Implementation
String? mask({int upto = 4, String mask = '*', bool atEnd = false}) {
if (length <= 1 || upto < 1 || length < upto) {
return this;
}
return atEnd
? substring(0, length - upto) + mask * upto
: mask * upto + substring(upto);
}