mask method
Masks input completely when preserving both ends would hide fewer
than minMasked characters.
Implementation
String mask(String input) {
final total = input.length;
final maskedCount = total - keepStart - keepEnd;
if (maskedCount <= 0 || maskedCount < minMasked) return maskChar * total;
final start = input.substring(0, keepStart);
final end = input.substring(total - keepEnd);
return '$start${maskChar * maskedCount}$end';
}