maskCVV function
Mask CVV
Type: String
Use in the masking process of CVV. It requires the card CVV and mask type and uses these two params to mask the card CVV.
Implementation
String maskCVV({required String cvv, required FMMaskType maskType}) {
// getting mask type condition added by the developer
bool full = maskType == FMMaskType.full;
bool none = maskType == FMMaskType.none;
String mask = "000";
// return the cvv input without validation to avoid length error
if (cvv.length >= 5) return cvv;
// checking if cvv is valid
if (full) {
mask = "*" * cvv.length;
} else if (none) {
mask = cvv;
}
// finally return the masked cvv
return mask;
}