hidePhone static method

String hidePhone(
  1. String phone, {
  2. int start = 3,
  3. int end = 7,
  4. String replace = '*',
})

隐藏部分手机号 Hide part of phone number

Implementation

static String hidePhone(String phone, {int start = 3, int end = 7, String replace = '*'}) {
  if (phone.length < 11) return phone;
  return phone.replaceRange(start, end, replace * (end - start));
}