maskNumber method

String maskNumber({
  1. int length = 4,
})

Implementation

String maskNumber({int length = 4}) {
  if (this.length <= length) return this;
  return '*' * (this.length - length) + substring(this.length - length);
}